matplotlib-rs 0.0.8__cp313-cp313-win_amd64.whl

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 (352) hide show
  1. docs/releases/0.0.1.md +268 -0
  2. docs/releases/0.0.2.md +69 -0
  3. docs/releases/0.0.3.md +80 -0
  4. docs/releases/0.0.4.md +73 -0
  5. docs/releases/0.0.5.md +24 -0
  6. docs/releases/0.0.6.md +24 -0
  7. docs/releases/0.0.7.md +24 -0
  8. docs/releases/0.0.8.md +16 -0
  9. licenses/LICENSE_CONTOURPY +29 -0
  10. licenses/LICENSE_CYCLER +27 -0
  11. licenses/LICENSE_DATEUTIL +54 -0
  12. licenses/LICENSE_KIWISOLVER +71 -0
  13. licenses/LICENSE_LIBWEBP +56 -0
  14. licenses/LICENSE_MATPLOTLIB +1253 -0
  15. licenses/LICENSE_PYPARSING +20 -0
  16. licenses/LICENSE_QHULL +39 -0
  17. licenses/LICENSE_SIX +18 -0
  18. matplotlib_rs/__init__.py +1683 -0
  19. matplotlib_rs/__main__.py +27 -0
  20. matplotlib_rs/_afm.py +500 -0
  21. matplotlib_rs/_animation_data.py +263 -0
  22. matplotlib_rs/_api/__init__.py +495 -0
  23. matplotlib_rs/_api/deprecation.py +534 -0
  24. matplotlib_rs/_axis_py.py +2991 -0
  25. matplotlib_rs/_blocking_input.py +31 -0
  26. matplotlib_rs/_cm.py +1500 -0
  27. matplotlib_rs/_cm_bivar.py +1289 -0
  28. matplotlib_rs/_cm_listed.py +2848 -0
  29. matplotlib_rs/_cm_multivar.py +167 -0
  30. matplotlib_rs/_color_data.py +1142 -0
  31. matplotlib_rs/_colormap.py +132 -0
  32. matplotlib_rs/_constrained_layout.py +825 -0
  33. matplotlib_rs/_contour.py +108 -0
  34. matplotlib_rs/_doc_cache.py +12214 -0
  35. matplotlib_rs/_docstring.py +142 -0
  36. matplotlib_rs/_enums.py +178 -0
  37. matplotlib_rs/_figure_rs.py +294 -0
  38. matplotlib_rs/_fontconfig_pattern.py +129 -0
  39. matplotlib_rs/_foreign.py +220 -0
  40. matplotlib_rs/_hook.py +94 -0
  41. matplotlib_rs/_image.py +160 -0
  42. matplotlib_rs/_imageio.py +229 -0
  43. matplotlib_rs/_internal_utils.py +65 -0
  44. matplotlib_rs/_kiwi.py +484 -0
  45. matplotlib_rs/_layoutgrid.py +549 -0
  46. matplotlib_rs/_live.py +192 -0
  47. matplotlib_rs/_mathtext.py +3103 -0
  48. matplotlib_rs/_mathtext_data.py +1811 -0
  49. matplotlib_rs/_mplrs.cp313-win_amd64.pyd +0 -0
  50. matplotlib_rs/_path.py +25 -0
  51. matplotlib_rs/_png.py +162 -0
  52. matplotlib_rs/_pylab_helpers.py +137 -0
  53. matplotlib_rs/_qhull.py +66 -0
  54. matplotlib_rs/_rcpush.py +84 -0
  55. matplotlib_rs/_spines_rs.py +108 -0
  56. matplotlib_rs/_style_helpers.py +52 -0
  57. matplotlib_rs/_text_helpers.py +51 -0
  58. matplotlib_rs/_tight_bbox.py +85 -0
  59. matplotlib_rs/_tight_layout.py +302 -0
  60. matplotlib_rs/_tri.py +140 -0
  61. matplotlib_rs/_type1font.py +1228 -0
  62. matplotlib_rs/_vendor/__init__.py +8 -0
  63. matplotlib_rs/_vendor/cycler.py +574 -0
  64. matplotlib_rs/_vendor/dateutil/__init__.py +27 -0
  65. matplotlib_rs/_vendor/dateutil/_common.py +44 -0
  66. matplotlib_rs/_vendor/dateutil/_tzdata_impl.py +148 -0
  67. matplotlib_rs/_vendor/dateutil/_version.py +5 -0
  68. matplotlib_rs/_vendor/dateutil/easter.py +90 -0
  69. matplotlib_rs/_vendor/dateutil/parser/__init__.py +62 -0
  70. matplotlib_rs/_vendor/dateutil/parser/_parser.py +1614 -0
  71. matplotlib_rs/_vendor/dateutil/parser/isoparser.py +417 -0
  72. matplotlib_rs/_vendor/dateutil/relativedelta.py +597 -0
  73. matplotlib_rs/_vendor/dateutil/rrule.py +1765 -0
  74. matplotlib_rs/_vendor/dateutil/tz/__init__.py +61 -0
  75. matplotlib_rs/_vendor/dateutil/tz/_common.py +420 -0
  76. matplotlib_rs/_vendor/dateutil/tz/_factories.py +81 -0
  77. matplotlib_rs/_vendor/dateutil/tz/_tzfile.py +1429 -0
  78. matplotlib_rs/_vendor/dateutil/tz/_tzpath.py +105 -0
  79. matplotlib_rs/_vendor/dateutil/tz/tz.py +1473 -0
  80. matplotlib_rs/_vendor/dateutil/tz/win.py +371 -0
  81. matplotlib_rs/_vendor/dateutil/tzwin.py +3 -0
  82. matplotlib_rs/_vendor/dateutil/utils.py +72 -0
  83. matplotlib_rs/_vendor/dateutil/zoneinfo/__init__.py +234 -0
  84. matplotlib_rs/_vendor/pyparsing/__init__.py +414 -0
  85. matplotlib_rs/_vendor/pyparsing/actions.py +265 -0
  86. matplotlib_rs/_vendor/pyparsing/common.py +571 -0
  87. matplotlib_rs/_vendor/pyparsing/core.py +6973 -0
  88. matplotlib_rs/_vendor/pyparsing/exceptions.py +354 -0
  89. matplotlib_rs/_vendor/pyparsing/helpers.py +1770 -0
  90. matplotlib_rs/_vendor/pyparsing/results.py +929 -0
  91. matplotlib_rs/_vendor/pyparsing/testing.py +399 -0
  92. matplotlib_rs/_vendor/pyparsing/unicode.py +357 -0
  93. matplotlib_rs/_vendor/pyparsing/util.py +515 -0
  94. matplotlib_rs/_vendor/pyparsing/warnings.py +11 -0
  95. matplotlib_rs/_vendor/six.py +1004 -0
  96. matplotlib_rs/animation.py +1843 -0
  97. matplotlib_rs/artist.py +2302 -0
  98. matplotlib_rs/axes/__init__.py +19 -0
  99. matplotlib_rs/axes/_axes.py +9402 -0
  100. matplotlib_rs/axes/_bar.py +185 -0
  101. matplotlib_rs/axes/_base.py +5236 -0
  102. matplotlib_rs/axes/_base_rs.py +727 -0
  103. matplotlib_rs/axes/_boxplot.py +391 -0
  104. matplotlib_rs/axes/_hist.py +99 -0
  105. matplotlib_rs/axes/_secondary_axes.py +357 -0
  106. matplotlib_rs/axis.py +1963 -0
  107. matplotlib_rs/backend_bases.py +3760 -0
  108. matplotlib_rs/backend_managers.py +388 -0
  109. matplotlib_rs/backend_tools.py +1002 -0
  110. matplotlib_rs/backends/__init__.py +6 -0
  111. matplotlib_rs/backends/_backend_pdf_ps.py +451 -0
  112. matplotlib_rs/backends/backend_agg.py +552 -0
  113. matplotlib_rs/backends/backend_mixed.py +123 -0
  114. matplotlib_rs/backends/backend_pdf.py +2711 -0
  115. matplotlib_rs/backends/backend_pgf.py +1031 -0
  116. matplotlib_rs/backends/backend_ps.py +1491 -0
  117. matplotlib_rs/backends/backend_svg.py +1395 -0
  118. matplotlib_rs/backends/backend_template.py +214 -0
  119. matplotlib_rs/backends/registry.py +423 -0
  120. matplotlib_rs/bezier.py +691 -0
  121. matplotlib_rs/category.py +236 -0
  122. matplotlib_rs/cbook.py +2762 -0
  123. matplotlib_rs/cm.py +251 -0
  124. matplotlib_rs/collections.py +2711 -0
  125. matplotlib_rs/colorbar.py +1586 -0
  126. matplotlib_rs/colorizer.py +909 -0
  127. matplotlib_rs/colors.py +4278 -0
  128. matplotlib_rs/container.py +256 -0
  129. matplotlib_rs/contour.py +1756 -0
  130. matplotlib_rs/dates.py +1847 -0
  131. matplotlib_rs/dviread.py +1386 -0
  132. matplotlib_rs/figure.py +3815 -0
  133. matplotlib_rs/font_manager.py +1855 -0
  134. matplotlib_rs/ft2font.py +515 -0
  135. matplotlib_rs/gridspec.py +808 -0
  136. matplotlib_rs/hatch.py +244 -0
  137. matplotlib_rs/image.py +1863 -0
  138. matplotlib_rs/inset.py +291 -0
  139. matplotlib_rs/layout_engine.py +310 -0
  140. matplotlib_rs/legend.py +1480 -0
  141. matplotlib_rs/legend_handler.py +812 -0
  142. matplotlib_rs/lines.py +1886 -0
  143. matplotlib_rs/markers.py +908 -0
  144. matplotlib_rs/mathtext.py +141 -0
  145. matplotlib_rs/mlab.py +959 -0
  146. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf +0 -0
  147. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf +0 -0
  148. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf +0 -0
  149. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans.ttf +0 -0
  150. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf +0 -0
  151. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf +0 -0
  152. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf +0 -0
  153. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf +0 -0
  154. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono.ttf +0 -0
  155. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf +0 -0
  156. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf +0 -0
  157. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf +0 -0
  158. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif.ttf +0 -0
  159. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf +0 -0
  160. matplotlib_rs/mpl-data/fonts/ttf/LICENSE_DEJAVU +99 -0
  161. matplotlib_rs/mpl-data/fonts/ttf/LICENSE_STIX +124 -0
  162. matplotlib_rs/mpl-data/fonts/ttf/LastResortHE-Regular.ttf +0 -0
  163. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneral.ttf +0 -0
  164. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBol.ttf +0 -0
  165. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf +0 -0
  166. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralItalic.ttf +0 -0
  167. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUni.ttf +0 -0
  168. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBol.ttf +0 -0
  169. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf +0 -0
  170. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniIta.ttf +0 -0
  171. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf +0 -0
  172. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf +0 -0
  173. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf +0 -0
  174. matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf +0 -0
  175. matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf +0 -0
  176. matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf +0 -0
  177. matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf +0 -0
  178. matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf +0 -0
  179. matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf +0 -0
  180. matplotlib_rs/mpl-data/fonts/ttf/cmb10.ttf +0 -0
  181. matplotlib_rs/mpl-data/fonts/ttf/cmex10.ttf +0 -0
  182. matplotlib_rs/mpl-data/fonts/ttf/cmmi10.ttf +0 -0
  183. matplotlib_rs/mpl-data/fonts/ttf/cmr10.ttf +0 -0
  184. matplotlib_rs/mpl-data/fonts/ttf/cmss10.ttf +0 -0
  185. matplotlib_rs/mpl-data/fonts/ttf/cmsy10.ttf +0 -0
  186. matplotlib_rs/mpl-data/fonts/ttf/cmti10.ttf +0 -0
  187. matplotlib_rs/mpl-data/fonts/ttf/cmtt10.ttf +0 -0
  188. matplotlib_rs/mpl-data/images/back-symbolic.svg +46 -0
  189. matplotlib_rs/mpl-data/images/back.pdf +0 -0
  190. matplotlib_rs/mpl-data/images/back.png +0 -0
  191. matplotlib_rs/mpl-data/images/back.svg +46 -0
  192. matplotlib_rs/mpl-data/images/back_large.png +0 -0
  193. matplotlib_rs/mpl-data/images/filesave-symbolic.svg +68 -0
  194. matplotlib_rs/mpl-data/images/filesave.pdf +72 -0
  195. matplotlib_rs/mpl-data/images/filesave.png +0 -0
  196. matplotlib_rs/mpl-data/images/filesave.svg +68 -0
  197. matplotlib_rs/mpl-data/images/filesave_large.png +0 -0
  198. matplotlib_rs/mpl-data/images/forward-symbolic.svg +46 -0
  199. matplotlib_rs/mpl-data/images/forward.pdf +0 -0
  200. matplotlib_rs/mpl-data/images/forward.png +0 -0
  201. matplotlib_rs/mpl-data/images/forward.svg +46 -0
  202. matplotlib_rs/mpl-data/images/forward_large.png +0 -0
  203. matplotlib_rs/mpl-data/images/hand.pdf +0 -0
  204. matplotlib_rs/mpl-data/images/hand.png +0 -0
  205. matplotlib_rs/mpl-data/images/hand.svg +130 -0
  206. matplotlib_rs/mpl-data/images/help-symbolic.svg +52 -0
  207. matplotlib_rs/mpl-data/images/help.pdf +71 -0
  208. matplotlib_rs/mpl-data/images/help.png +0 -0
  209. matplotlib_rs/mpl-data/images/help.svg +52 -0
  210. matplotlib_rs/mpl-data/images/help_large.png +0 -0
  211. matplotlib_rs/mpl-data/images/home-symbolic.svg +59 -0
  212. matplotlib_rs/mpl-data/images/home.pdf +0 -0
  213. matplotlib_rs/mpl-data/images/home.png +0 -0
  214. matplotlib_rs/mpl-data/images/home.svg +59 -0
  215. matplotlib_rs/mpl-data/images/home_large.png +0 -0
  216. matplotlib_rs/mpl-data/images/matplotlib.pdf +0 -0
  217. matplotlib_rs/mpl-data/images/matplotlib.png +0 -0
  218. matplotlib_rs/mpl-data/images/matplotlib.svg +3171 -0
  219. matplotlib_rs/mpl-data/images/matplotlib_large.png +0 -0
  220. matplotlib_rs/mpl-data/images/move-symbolic.svg +73 -0
  221. matplotlib_rs/mpl-data/images/move.pdf +0 -0
  222. matplotlib_rs/mpl-data/images/move.png +0 -0
  223. matplotlib_rs/mpl-data/images/move.svg +73 -0
  224. matplotlib_rs/mpl-data/images/move_large.png +0 -0
  225. matplotlib_rs/mpl-data/images/qt4_editor_options.pdf +0 -0
  226. matplotlib_rs/mpl-data/images/qt4_editor_options.png +0 -0
  227. matplotlib_rs/mpl-data/images/qt4_editor_options.svg +48 -0
  228. matplotlib_rs/mpl-data/images/qt4_editor_options_large.png +0 -0
  229. matplotlib_rs/mpl-data/images/subplots-symbolic.svg +81 -0
  230. matplotlib_rs/mpl-data/images/subplots.pdf +0 -0
  231. matplotlib_rs/mpl-data/images/subplots.png +0 -0
  232. matplotlib_rs/mpl-data/images/subplots.svg +81 -0
  233. matplotlib_rs/mpl-data/images/subplots_large.png +0 -0
  234. matplotlib_rs/mpl-data/images/zoom_to_rect-symbolic.svg +40 -0
  235. matplotlib_rs/mpl-data/images/zoom_to_rect.pdf +69 -0
  236. matplotlib_rs/mpl-data/images/zoom_to_rect.png +0 -0
  237. matplotlib_rs/mpl-data/images/zoom_to_rect.svg +40 -0
  238. matplotlib_rs/mpl-data/images/zoom_to_rect_large.png +0 -0
  239. matplotlib_rs/mpl-data/kpsewhich.lua +4 -0
  240. matplotlib_rs/mpl-data/matplotlibrc +849 -0
  241. matplotlib_rs/mpl-data/plot_directive/plot_directive.css +16 -0
  242. matplotlib_rs/mpl-data/sample_data/Minduka_Present_Blue_Pack.png +0 -0
  243. matplotlib_rs/mpl-data/sample_data/README.txt +2 -0
  244. matplotlib_rs/mpl-data/sample_data/Stocks.csv +526 -0
  245. matplotlib_rs/mpl-data/sample_data/axes_grid/bivariate_normal.npy +0 -0
  246. matplotlib_rs/mpl-data/sample_data/data_x_x2_x3.csv +11 -0
  247. matplotlib_rs/mpl-data/sample_data/eeg.dat +0 -0
  248. matplotlib_rs/mpl-data/sample_data/embedding_in_wx3.xrc +65 -0
  249. matplotlib_rs/mpl-data/sample_data/goog.npz +0 -0
  250. matplotlib_rs/mpl-data/sample_data/grace_hopper.jpg +0 -0
  251. matplotlib_rs/mpl-data/sample_data/jacksboro_fault_dem.npz +0 -0
  252. matplotlib_rs/mpl-data/sample_data/logo2.png +0 -0
  253. matplotlib_rs/mpl-data/sample_data/membrane.dat +0 -0
  254. matplotlib_rs/mpl-data/sample_data/msft.csv +66 -0
  255. matplotlib_rs/mpl-data/sample_data/s1045.ima.gz +0 -0
  256. matplotlib_rs/mpl-data/sample_data/topobathy.npz +0 -0
  257. matplotlib_rs/mpl-data/stylelib/Solarize_Light2.mplstyle +53 -0
  258. matplotlib_rs/mpl-data/stylelib/_classic_test_patch.mplstyle +8 -0
  259. matplotlib_rs/mpl-data/stylelib/_mpl-gallery-nogrid.mplstyle +19 -0
  260. matplotlib_rs/mpl-data/stylelib/_mpl-gallery.mplstyle +19 -0
  261. matplotlib_rs/mpl-data/stylelib/bmh.mplstyle +27 -0
  262. matplotlib_rs/mpl-data/stylelib/classic.mplstyle +491 -0
  263. matplotlib_rs/mpl-data/stylelib/dark_background.mplstyle +26 -0
  264. matplotlib_rs/mpl-data/stylelib/fast.mplstyle +11 -0
  265. matplotlib_rs/mpl-data/stylelib/fivethirtyeight.mplstyle +37 -0
  266. matplotlib_rs/mpl-data/stylelib/ggplot.mplstyle +39 -0
  267. matplotlib_rs/mpl-data/stylelib/grayscale.mplstyle +29 -0
  268. matplotlib_rs/mpl-data/stylelib/petroff10.mplstyle +5 -0
  269. matplotlib_rs/mpl-data/stylelib/petroff6.mplstyle +5 -0
  270. matplotlib_rs/mpl-data/stylelib/petroff8.mplstyle +5 -0
  271. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-bright.mplstyle +3 -0
  272. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-colorblind.mplstyle +3 -0
  273. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark-palette.mplstyle +3 -0
  274. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark.mplstyle +30 -0
  275. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-darkgrid.mplstyle +30 -0
  276. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-deep.mplstyle +3 -0
  277. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-muted.mplstyle +3 -0
  278. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-notebook.mplstyle +21 -0
  279. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-paper.mplstyle +21 -0
  280. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-pastel.mplstyle +3 -0
  281. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-poster.mplstyle +21 -0
  282. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-talk.mplstyle +21 -0
  283. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-ticks.mplstyle +30 -0
  284. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-white.mplstyle +30 -0
  285. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-whitegrid.mplstyle +30 -0
  286. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8.mplstyle +57 -0
  287. matplotlib_rs/mpl-data/stylelib/tableau-colorblind10.mplstyle +3 -0
  288. matplotlib_rs/mpl_toolkits/__init__.py +3 -0
  289. matplotlib_rs/mpl_toolkits/axes_grid1/__init__.py +11 -0
  290. matplotlib_rs/mpl_toolkits/axes_grid1/anchored_artists.py +415 -0
  291. matplotlib_rs/mpl_toolkits/axes_grid1/axes_divider.py +619 -0
  292. matplotlib_rs/mpl_toolkits/axes_grid1/axes_grid.py +565 -0
  293. matplotlib_rs/mpl_toolkits/axes_grid1/axes_rgb.py +158 -0
  294. matplotlib_rs/mpl_toolkits/axes_grid1/axes_size.py +272 -0
  295. matplotlib_rs/mpl_toolkits/axes_grid1/inset_locator.py +525 -0
  296. matplotlib_rs/mpl_toolkits/axes_grid1/mpl_axes.py +129 -0
  297. matplotlib_rs/mpl_toolkits/axes_grid1/parasite_axes.py +261 -0
  298. matplotlib_rs/mpl_toolkits/axisartist/__init__.py +15 -0
  299. matplotlib_rs/mpl_toolkits/axisartist/angle_helper.py +396 -0
  300. matplotlib_rs/mpl_toolkits/axisartist/axes_divider.py +3 -0
  301. matplotlib_rs/mpl_toolkits/axisartist/axis_artist.py +1148 -0
  302. matplotlib_rs/mpl_toolkits/axisartist/axisline_style.py +193 -0
  303. matplotlib_rs/mpl_toolkits/axisartist/axislines.py +475 -0
  304. matplotlib_rs/mpl_toolkits/axisartist/floating_axes.py +265 -0
  305. matplotlib_rs/mpl_toolkits/axisartist/grid_finder.py +329 -0
  306. matplotlib_rs/mpl_toolkits/axisartist/grid_helper_curvelinear.py +353 -0
  307. matplotlib_rs/mpl_toolkits/axisartist/parasite_axes.py +8 -0
  308. matplotlib_rs/mpl_toolkits/mplot3d/__init__.py +4 -0
  309. matplotlib_rs/mpl_toolkits/mplot3d/art3d.py +1758 -0
  310. matplotlib_rs/mpl_toolkits/mplot3d/axes3d.py +4462 -0
  311. matplotlib_rs/mpl_toolkits/mplot3d/axis3d.py +807 -0
  312. matplotlib_rs/mpl_toolkits/mplot3d/proj3d.py +270 -0
  313. matplotlib_rs/offsetbox.py +1726 -0
  314. matplotlib_rs/patches.py +5049 -0
  315. matplotlib_rs/path.py +1147 -0
  316. matplotlib_rs/patheffects.py +512 -0
  317. matplotlib_rs/projections/__init__.py +126 -0
  318. matplotlib_rs/projections/geo.py +512 -0
  319. matplotlib_rs/projections/polar.py +1518 -0
  320. matplotlib_rs/pylab.py +68 -0
  321. matplotlib_rs/pyplot.py +4834 -0
  322. matplotlib_rs/quiver.py +1236 -0
  323. matplotlib_rs/rcsetup.py +3435 -0
  324. matplotlib_rs/sankey.py +815 -0
  325. matplotlib_rs/scale.py +1002 -0
  326. matplotlib_rs/spines.py +618 -0
  327. matplotlib_rs/stackplot.py +144 -0
  328. matplotlib_rs/streamplot.py +768 -0
  329. matplotlib_rs/style/__init__.py +269 -0
  330. matplotlib_rs/style/core.py +28 -0
  331. matplotlib_rs/table.py +860 -0
  332. matplotlib_rs/texmanager.py +375 -0
  333. matplotlib_rs/text.py +2412 -0
  334. matplotlib_rs/textpath.py +377 -0
  335. matplotlib_rs/ticker.py +3111 -0
  336. matplotlib_rs/transforms.py +3069 -0
  337. matplotlib_rs/tri/__init__.py +24 -0
  338. matplotlib_rs/tri/_triangulation.py +248 -0
  339. matplotlib_rs/tri/_tricontour.py +271 -0
  340. matplotlib_rs/tri/_trifinder.py +97 -0
  341. matplotlib_rs/tri/_triinterpolate.py +1575 -0
  342. matplotlib_rs/tri/_tripcolor.py +170 -0
  343. matplotlib_rs/tri/_triplot.py +87 -0
  344. matplotlib_rs/tri/_trirefine.py +308 -0
  345. matplotlib_rs/tri/_tritools.py +264 -0
  346. matplotlib_rs/typing.py +597 -0
  347. matplotlib_rs/units.py +196 -0
  348. matplotlib_rs/widgets.py +4455 -0
  349. matplotlib_rs-0.0.8.dist-info/METADATA +392 -0
  350. matplotlib_rs-0.0.8.dist-info/RECORD +352 -0
  351. matplotlib_rs-0.0.8.dist-info/WHEEL +4 -0
  352. matplotlib_rs-0.0.8.dist-info/sboms/matplotlib-rs.cyclonedx.json +4390 -0
@@ -0,0 +1,929 @@
1
+ # Vendored by tools/vendor_deps.py from pyparsing 3.3.3 (see licenses/LICENSE_PYPARSING).
2
+ # results.py
3
+
4
+ from __future__ import annotations
5
+
6
+ import collections
7
+ from collections.abc import (
8
+ MutableMapping,
9
+ Mapping,
10
+ MutableSequence,
11
+ Iterator,
12
+ Iterable,
13
+ )
14
+ import pprint
15
+ from typing import Any
16
+
17
+ from .util import deprecate_argument, _is_iterable, _flatten
18
+
19
+
20
+ str_type: tuple[type, ...] = (str, bytes)
21
+ _generator_type = type((_ for _ in ()))
22
+ NULL_SLICE: slice = slice(None)
23
+
24
+
25
+ class _ParseResultsWithOffset:
26
+ tup: tuple[ParseResults, int]
27
+ __slots__ = ["tup"]
28
+
29
+ def __init__(self, p1: ParseResults, p2: int) -> None:
30
+ self.tup: tuple[ParseResults, int] = (p1, p2)
31
+
32
+ def __getitem__(self, i):
33
+ return self.tup[i]
34
+
35
+ def __getstate__(self):
36
+ return self.tup
37
+
38
+ def __setstate__(self, *args):
39
+ self.tup = args[0]
40
+
41
+
42
+ class ParseResults:
43
+ """Structured parse results, to provide multiple means of access to
44
+ the parsed data:
45
+
46
+ - as a list (``len(results)``)
47
+ - by list index (``results[0], results[1]``, etc.)
48
+ - by attribute (``results.<results_name>`` - see :class:`ParserElement.set_results_name`)
49
+
50
+ Example:
51
+
52
+ .. testcode::
53
+
54
+ integer = Word(nums)
55
+ date_str = (integer.set_results_name("year") + '/'
56
+ + integer.set_results_name("month") + '/'
57
+ + integer.set_results_name("day"))
58
+ # equivalent form:
59
+ # date_str = (integer("year") + '/'
60
+ # + integer("month") + '/'
61
+ # + integer("day"))
62
+
63
+ # parse_string returns a ParseResults object
64
+ result = date_str.parse_string("1999/12/31")
65
+
66
+ def test(s, fn=repr):
67
+ print(f"{s} -> {fn(eval(s))}")
68
+
69
+ test("list(result)")
70
+ test("result[0]")
71
+ test("result['month']")
72
+ test("result.day")
73
+ test("'month' in result")
74
+ test("'minutes' in result")
75
+ test("result.dump()", str)
76
+
77
+ prints:
78
+
79
+ .. testoutput::
80
+
81
+ list(result) -> ['1999', '/', '12', '/', '31']
82
+ result[0] -> '1999'
83
+ result['month'] -> '12'
84
+ result.day -> '31'
85
+ 'month' in result -> True
86
+ 'minutes' in result -> False
87
+ result.dump() -> ['1999', '/', '12', '/', '31']
88
+ - day: '31'
89
+ - month: '12'
90
+ - year: '1999'
91
+
92
+ """
93
+
94
+ _null_values: tuple[Any, ...] = (None, [], ())
95
+
96
+ _name: str
97
+ _parent: ParseResults
98
+ _all_names: set[str]
99
+ _modal: bool
100
+ _toklist: list[Any]
101
+ _tokdict: dict[str, Any]
102
+
103
+ __slots__ = (
104
+ "_name",
105
+ "_parent",
106
+ "_all_names",
107
+ "_modal",
108
+ "_toklist",
109
+ "_tokdict",
110
+ )
111
+
112
+ class List(list):
113
+ """
114
+ Simple wrapper class to distinguish parsed list results that should be preserved
115
+ as actual Python lists, instead of being converted to :class:`ParseResults`:
116
+
117
+ .. testcode::
118
+
119
+ import pyparsing as pp
120
+ ppc = pp.common
121
+
122
+ LBRACK, RBRACK, LPAR, RPAR = pp.Suppress.using_each("[]()")
123
+ element = pp.Forward()
124
+ item = ppc.integer
125
+ item_list = pp.DelimitedList(element)
126
+ element_list = LBRACK + item_list + RBRACK | LPAR + item_list + RPAR
127
+ element <<= item | element_list
128
+
129
+ # add parse action to convert from ParseResults
130
+ # to actual Python collection types
131
+ @element_list.add_parse_action
132
+ def as_python_list(t):
133
+ return pp.ParseResults.List(t.as_list())
134
+
135
+ element.run_tests('''
136
+ 100
137
+ [2,3,4]
138
+ [[2, 1],3,4]
139
+ [(2, 1),3,4]
140
+ (2,3,4)
141
+ ([2, 3], 4)
142
+ ''', post_parse=lambda s, r: (r[0], type(r[0]))
143
+ )
144
+
145
+ prints:
146
+
147
+ .. testoutput::
148
+ :options: +NORMALIZE_WHITESPACE
149
+
150
+
151
+ 100
152
+ (100, <class 'int'>)
153
+
154
+ [2,3,4]
155
+ ([2, 3, 4], <class 'list'>)
156
+
157
+ [[2, 1],3,4]
158
+ ([[2, 1], 3, 4], <class 'list'>)
159
+
160
+ [(2, 1),3,4]
161
+ ([[2, 1], 3, 4], <class 'list'>)
162
+
163
+ (2,3,4)
164
+ ([2, 3, 4], <class 'list'>)
165
+
166
+ ([2, 3], 4)
167
+ ([[2, 3], 4], <class 'list'>)
168
+
169
+ (Used internally by :class:`Group` when `aslist=True`.)
170
+ """
171
+
172
+ def __new__(cls, contained=None):
173
+ if contained is None:
174
+ contained = []
175
+
176
+ if not isinstance(contained, list):
177
+ raise TypeError(
178
+ f"{cls.__name__} may only be constructed with a list, not {type(contained).__name__}"
179
+ )
180
+
181
+ return list.__new__(cls)
182
+
183
+ def __new__(cls, toklist=None, name=None, **kwargs):
184
+ if isinstance(toklist, ParseResults):
185
+ return toklist
186
+ self = object.__new__(cls)
187
+ self._name = None
188
+ self._parent = None
189
+ self._all_names = set()
190
+
191
+ if toklist is None:
192
+ self._toklist = []
193
+ elif isinstance(toklist, (list, _generator_type)):
194
+ self._toklist = (
195
+ [toklist[:]]
196
+ if isinstance(toklist, ParseResults.List)
197
+ else list(toklist)
198
+ )
199
+ else:
200
+ self._toklist = [toklist]
201
+ self._tokdict = dict()
202
+ return self
203
+
204
+ # Performance tuning: we construct a *lot* of these, so keep this
205
+ # constructor as small and fast as possible
206
+ def __init__(
207
+ self,
208
+ toklist=None,
209
+ name=None,
210
+ aslist=True,
211
+ modal=True,
212
+ isinstance=isinstance,
213
+ **kwargs,
214
+ ) -> None:
215
+ asList = deprecate_argument(kwargs, "asList", True, new_name="aslist")
216
+
217
+ asList = asList and aslist
218
+ self._tokdict: dict[str, _ParseResultsWithOffset]
219
+ self._modal = modal
220
+
221
+ if name is None or name == "":
222
+ return
223
+
224
+ if isinstance(name, int):
225
+ name = str(name)
226
+
227
+ if not modal:
228
+ self._all_names = {name}
229
+
230
+ self._name = name
231
+
232
+ if toklist in self._null_values:
233
+ return
234
+
235
+ if isinstance(toklist, (str_type, type)):
236
+ toklist = [toklist]
237
+
238
+ if asList:
239
+ if isinstance(toklist, ParseResults):
240
+ self[name] = _ParseResultsWithOffset(ParseResults(toklist._toklist), 0)
241
+ else:
242
+ self[name] = _ParseResultsWithOffset(ParseResults(toklist[0]), 0)
243
+ self[name]._name = name
244
+ return
245
+
246
+ try:
247
+ self[name] = toklist[0]
248
+ except (KeyError, TypeError, IndexError):
249
+ if toklist is not self:
250
+ self[name] = toklist
251
+ else:
252
+ self._name = name
253
+
254
+ def __getitem__(self, i):
255
+ if isinstance(i, (int, slice)):
256
+ return self._toklist[i]
257
+
258
+ if i not in self._all_names:
259
+ return self._tokdict[i][-1][0]
260
+
261
+ return ParseResults([v[0] for v in self._tokdict[i]])
262
+
263
+ def __setitem__(self, k, v, isinstance=isinstance):
264
+ if isinstance(v, _ParseResultsWithOffset):
265
+ self._tokdict[k] = self._tokdict.get(k, list()) + [v]
266
+ sub = v[0]
267
+ elif isinstance(k, (int, slice)):
268
+ self._toklist[k] = v
269
+ sub = v
270
+ else:
271
+ self._tokdict[k] = self._tokdict.get(k, []) + [
272
+ _ParseResultsWithOffset(v, 0)
273
+ ]
274
+ sub = v
275
+ if isinstance(sub, ParseResults):
276
+ sub._parent = self
277
+
278
+ def __delitem__(self, i):
279
+ if not isinstance(i, (int, slice)):
280
+ del self._tokdict[i]
281
+ return
282
+
283
+ # slight optimization if del results[:]
284
+ if i == NULL_SLICE:
285
+ self._toklist.clear()
286
+ return
287
+
288
+ mylen = len(self._toklist)
289
+ del self._toklist[i]
290
+
291
+ # convert int to slice
292
+ if isinstance(i, int):
293
+ if i < 0:
294
+ i += mylen
295
+ i = slice(i, i + 1)
296
+ # get removed indices
297
+ removed = list(range(*i.indices(mylen)))
298
+ removed.reverse()
299
+ # fixup indices in token dictionary
300
+ for occurrences in self._tokdict.values():
301
+ for j in removed:
302
+ for k, (value, position) in enumerate(occurrences):
303
+ occurrences[k] = _ParseResultsWithOffset(
304
+ value, position - (position > j)
305
+ )
306
+
307
+ def __contains__(self, k) -> bool:
308
+ return k in self._tokdict
309
+
310
+ def __len__(self) -> int:
311
+ return len(self._toklist)
312
+
313
+ def __bool__(self) -> bool:
314
+ return not not (self._toklist or self._tokdict)
315
+
316
+ def __iter__(self) -> Iterator:
317
+ return iter(self._toklist)
318
+
319
+ def __reversed__(self) -> Iterator:
320
+ return iter(self._toklist[::-1])
321
+
322
+ def keys(self):
323
+ return iter(self._tokdict)
324
+
325
+ def values(self):
326
+ return (self[k] for k in self.keys())
327
+
328
+ def items(self):
329
+ return ((k, self[k]) for k in self.keys())
330
+
331
+ def haskeys(self) -> bool:
332
+ """
333
+ Since ``keys()`` returns an iterator, this method is helpful in bypassing
334
+ code that looks for the existence of any defined results names."""
335
+ return not not self._tokdict
336
+
337
+ def pop(self, *args, **kwargs):
338
+ """
339
+ Removes and returns item at specified index (default= ``last``).
340
+ Supports both ``list`` and ``dict`` semantics for ``pop()``. If
341
+ passed no argument or an integer argument, it will use ``list``
342
+ semantics and pop tokens from the list of parsed tokens. If passed
343
+ a non-integer argument (most likely a string), it will use ``dict``
344
+ semantics and pop the corresponding value from any defined results
345
+ names. A second default return value argument is supported, just as in
346
+ ``dict.pop()``.
347
+
348
+ Example:
349
+
350
+ .. doctest::
351
+
352
+ >>> numlist = Word(nums)[...]
353
+ >>> print(numlist.parse_string("0 123 321"))
354
+ ['0', '123', '321']
355
+
356
+ >>> def remove_first(tokens):
357
+ ... tokens.pop(0)
358
+ ...
359
+ >>> numlist.add_parse_action(remove_first)
360
+ [W:(0-9)]...
361
+ >>> print(numlist.parse_string("0 123 321"))
362
+ ['123', '321']
363
+
364
+ >>> label = Word(alphas)
365
+ >>> patt = label("LABEL") + Word(nums)[1, ...]
366
+ >>> print(patt.parse_string("AAB 123 321").dump())
367
+ ['AAB', '123', '321']
368
+ - LABEL: 'AAB'
369
+
370
+ >>> # Use pop() in a parse action to remove named result
371
+ >>> # (note that corresponding value is not
372
+ >>> # removed from list form of results)
373
+ >>> def remove_LABEL(tokens):
374
+ ... tokens.pop("LABEL")
375
+ ... return tokens
376
+ ...
377
+ >>> patt.add_parse_action(remove_LABEL)
378
+ {W:(A-Za-z) {W:(0-9)}...}
379
+ >>> print(patt.parse_string("AAB 123 321").dump())
380
+ ['AAB', '123', '321']
381
+
382
+ """
383
+ if not args:
384
+ args = [-1]
385
+ for k, v in kwargs.items():
386
+ if k == "default":
387
+ args = (args[0], v)
388
+ else:
389
+ raise TypeError(f"pop() got an unexpected keyword argument {k!r}")
390
+ if isinstance(args[0], int) or len(args) == 1 or args[0] in self:
391
+ index = args[0]
392
+ ret = self[index]
393
+ del self[index]
394
+ return ret
395
+ else:
396
+ defaultvalue = args[1]
397
+ return defaultvalue
398
+
399
+ def get(self, key, default_value=None):
400
+ """
401
+ Returns named result matching the given key, or if there is no
402
+ such name, then returns the given ``default_value`` or ``None`` if no
403
+ ``default_value`` is specified.
404
+
405
+ Similar to ``dict.get()``.
406
+
407
+ Example:
408
+
409
+ .. doctest::
410
+
411
+ >>> integer = Word(nums)
412
+ >>> date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
413
+
414
+ >>> result = date_str.parse_string("1999/12/31")
415
+ >>> result.get("year")
416
+ '1999'
417
+ >>> result.get("hour", "not specified")
418
+ 'not specified'
419
+ >>> result.get("hour")
420
+
421
+ """
422
+ if key in self:
423
+ return self[key]
424
+ else:
425
+ return default_value
426
+
427
+ def insert(self, index, ins_string):
428
+ """
429
+ Inserts new element at location index in the list of parsed tokens.
430
+
431
+ Similar to ``list.insert()``.
432
+
433
+ Example:
434
+
435
+ .. doctest::
436
+
437
+ >>> numlist = Word(nums)[...]
438
+ >>> print(numlist.parse_string("0 123 321"))
439
+ ['0', '123', '321']
440
+
441
+ >>> # use a parse action to insert the parse location
442
+ >>> # in the front of the parsed results
443
+ >>> def insert_locn(locn, tokens):
444
+ ... tokens.insert(0, locn)
445
+ ...
446
+ >>> numlist.add_parse_action(insert_locn)
447
+ [W:(0-9)]...
448
+ >>> print(numlist.parse_string("0 123 321"))
449
+ [0, '0', '123', '321']
450
+
451
+ """
452
+ self._toklist.insert(index, ins_string)
453
+ # fixup indices in token dictionary
454
+ for occurrences in self._tokdict.values():
455
+ for k, (value, position) in enumerate(occurrences):
456
+ occurrences[k] = _ParseResultsWithOffset(
457
+ value, position + (position > index)
458
+ )
459
+
460
+ def append(self, item):
461
+ """
462
+ Add single element to end of ``ParseResults`` list of elements.
463
+
464
+ Example:
465
+
466
+ .. doctest::
467
+
468
+ >>> numlist = Word(nums)[...]
469
+ >>> print(numlist.parse_string("0 123 321"))
470
+ ['0', '123', '321']
471
+
472
+ >>> # use a parse action to compute the sum of the parsed integers,
473
+ >>> # and add it to the end
474
+ >>> def append_sum(tokens):
475
+ ... tokens.append(sum(map(int, tokens)))
476
+ ...
477
+ >>> numlist.add_parse_action(append_sum)
478
+ [W:(0-9)]...
479
+ >>> print(numlist.parse_string("0 123 321"))
480
+ ['0', '123', '321', 444]
481
+ """
482
+ self._toklist.append(item)
483
+
484
+ def extend(self, itemseq):
485
+ """
486
+ Add sequence of elements to end of :class:`ParseResults` list of elements.
487
+
488
+ Example:
489
+
490
+ .. testcode::
491
+
492
+ patt = Word(alphas)[1, ...]
493
+
494
+ # use a parse action to append the reverse of the matched strings,
495
+ # to make a palindrome
496
+ def make_palindrome(tokens):
497
+ tokens.extend(reversed([t[::-1] for t in tokens]))
498
+ return ''.join(tokens)
499
+
500
+ patt.add_parse_action(make_palindrome)
501
+ print(patt.parse_string("lskdj sdlkjf lksd"))
502
+
503
+ prints:
504
+
505
+ .. testoutput::
506
+
507
+ ['lskdjsdlkjflksddsklfjkldsjdksl']
508
+ """
509
+ if isinstance(itemseq, ParseResults):
510
+ self.__iadd__(itemseq)
511
+ else:
512
+ self._toklist.extend(itemseq)
513
+
514
+ def clear(self):
515
+ """
516
+ Clear all elements and results names.
517
+ """
518
+ del self._toklist[:]
519
+ self._tokdict.clear()
520
+
521
+ def __getattr__(self, name):
522
+ try:
523
+ return self[name]
524
+ except KeyError:
525
+ if name.startswith("__"):
526
+ raise AttributeError(name)
527
+ return ""
528
+
529
+ def __add__(self, other: ParseResults) -> ParseResults:
530
+ ret = self.copy()
531
+ ret += other
532
+ return ret
533
+
534
+ def __iadd__(self, other: ParseResults) -> ParseResults:
535
+ if not other:
536
+ return self
537
+
538
+ if other._tokdict:
539
+ offset = len(self._toklist)
540
+ addoffset = lambda a: offset if a < 0 else a + offset
541
+ otheritems = other._tokdict.items()
542
+ otherdictitems = [
543
+ (k, _ParseResultsWithOffset(v[0], addoffset(v[1])))
544
+ for k, vlist in otheritems
545
+ for v in vlist
546
+ ]
547
+ for k, v in otherdictitems:
548
+ self[k] = v
549
+ if isinstance(v[0], ParseResults):
550
+ v[0]._parent = self
551
+
552
+ self._toklist += other._toklist
553
+ self._all_names |= other._all_names
554
+ return self
555
+
556
+ def __radd__(self, other) -> ParseResults:
557
+ if isinstance(other, int) and other == 0:
558
+ # useful for merging many ParseResults using sum() builtin
559
+ return self.copy()
560
+ else:
561
+ # this may raise a TypeError - so be it
562
+ return other + self
563
+
564
+ def __repr__(self) -> str:
565
+ return f"{type(self).__name__}({self._toklist!r}, {self.as_dict()})"
566
+
567
+ def __str__(self) -> str:
568
+ return (
569
+ "["
570
+ + ", ".join(
571
+ [
572
+ str(i) if isinstance(i, ParseResults) else repr(i)
573
+ for i in self._toklist
574
+ ]
575
+ )
576
+ + "]"
577
+ )
578
+
579
+ def _asStringList(self, sep=""):
580
+ out = []
581
+ for item in self._toklist:
582
+ if out and sep:
583
+ out.append(sep)
584
+ if isinstance(item, ParseResults):
585
+ out += item._asStringList()
586
+ else:
587
+ out.append(str(item))
588
+ return out
589
+
590
+ def as_list(self, *, flatten: bool = False) -> list:
591
+ """
592
+ Returns the parse results as a nested list of matching tokens, all converted to strings.
593
+ If ``flatten`` is True, all the nesting levels in the returned list are collapsed.
594
+
595
+ Example:
596
+
597
+ .. doctest::
598
+
599
+ >>> patt = Word(alphas)[1, ...]
600
+ >>> result = patt.parse_string("sldkj lsdkj sldkj")
601
+ >>> # even though the result prints in string-like form,
602
+ >>> # it is actually a pyparsing ParseResults
603
+ >>> type(result)
604
+ <class 'pyparsing.results.ParseResults'>
605
+ >>> print(result)
606
+ ['sldkj', 'lsdkj', 'sldkj']
607
+
608
+ .. doctest::
609
+
610
+ >>> # Use as_list() to create an actual list
611
+ >>> result_list = result.as_list()
612
+ >>> type(result_list)
613
+ <class 'list'>
614
+ >>> print(result_list)
615
+ ['sldkj', 'lsdkj', 'sldkj']
616
+
617
+ .. versionchanged:: 3.2.0
618
+ New ``flatten`` argument.
619
+ """
620
+
621
+ if flatten:
622
+ return [*_flatten(self)]
623
+ else:
624
+ return [
625
+ res.as_list() if isinstance(res, ParseResults) else res
626
+ for res in self._toklist
627
+ ]
628
+
629
+ def as_dict(self) -> dict:
630
+ """
631
+ Returns the named parse results as a nested dictionary.
632
+
633
+ Example:
634
+
635
+ .. doctest::
636
+
637
+ >>> integer = pp.Word(pp.nums)
638
+ >>> date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
639
+
640
+ >>> result = date_str.parse_string('1999/12/31')
641
+ >>> type(result)
642
+ <class 'pyparsing.results.ParseResults'>
643
+ >>> result
644
+ ParseResults(['1999', '/', '12', '/', '31'], {'year': '1999', 'month': '12', 'day': '31'})
645
+
646
+ >>> result_dict = result.as_dict()
647
+ >>> type(result_dict)
648
+ <class 'dict'>
649
+ >>> result_dict
650
+ {'year': '1999', 'month': '12', 'day': '31'}
651
+
652
+ >>> # even though a ParseResults supports dict-like access,
653
+ >>> # sometime you just need to have a dict
654
+ >>> import json
655
+ >>> print(json.dumps(result))
656
+ Traceback (most recent call last):
657
+ TypeError: Object of type ParseResults is not JSON serializable
658
+ >>> print(json.dumps(result.as_dict()))
659
+ {"year": "1999", "month": "12", "day": "31"}
660
+ """
661
+
662
+ def to_item(obj):
663
+ if isinstance(obj, ParseResults):
664
+ return obj.as_dict() if obj.haskeys() else [to_item(v) for v in obj]
665
+ else:
666
+ return obj
667
+
668
+ return dict((k, to_item(v)) for k, v in self.items())
669
+
670
+ def copy(self) -> ParseResults:
671
+ """
672
+ Returns a new shallow copy of a :class:`ParseResults` object.
673
+ :class:`ParseResults` items contained within the source are
674
+ shared with the copy. Use :meth:`ParseResults.deepcopy` to
675
+ create a copy with its own separate content values.
676
+ """
677
+ ret = ParseResults(self._toklist)
678
+ ret._tokdict = self._tokdict.copy()
679
+ ret._parent = self._parent
680
+ ret._all_names |= self._all_names
681
+ ret._name = self._name
682
+ return ret
683
+
684
+ def deepcopy(self) -> ParseResults:
685
+ """
686
+ Returns a new deep copy of a :class:`ParseResults` object.
687
+
688
+ .. versionadded:: 3.1.0
689
+ """
690
+ ret = self.copy()
691
+ # replace values with copies if they are of known mutable types
692
+ for i, obj in enumerate(self._toklist):
693
+ if isinstance(obj, ParseResults):
694
+ ret._toklist[i] = obj.deepcopy()
695
+ elif isinstance(obj, (str, bytes)):
696
+ pass
697
+ elif isinstance(obj, MutableMapping):
698
+ ret._toklist[i] = dest = type(obj)()
699
+ for k, v in obj.items():
700
+ dest[k] = v.deepcopy() if isinstance(v, ParseResults) else v
701
+ elif isinstance(obj, Iterable):
702
+ ret._toklist[i] = type(obj)(
703
+ v.deepcopy() if isinstance(v, ParseResults) else v for v in obj # type: ignore[call-arg]
704
+ )
705
+ return ret
706
+
707
+ def get_name(self) -> str | None:
708
+ r"""
709
+ Returns the results name for this token expression.
710
+
711
+ Useful when several different expressions might match
712
+ at a particular location.
713
+
714
+ Example:
715
+
716
+ .. testcode::
717
+
718
+ integer = Word(nums)
719
+ ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
720
+ house_number_expr = Suppress('#') + Word(nums, alphanums)
721
+ user_data = (Group(house_number_expr)("house_number")
722
+ | Group(ssn_expr)("ssn")
723
+ | Group(integer)("age"))
724
+ user_info = user_data[1, ...]
725
+
726
+ result = user_info.parse_string("22 111-22-3333 #221B")
727
+ for item in result:
728
+ print(item.get_name(), ':', item[0])
729
+
730
+ prints:
731
+
732
+ .. testoutput::
733
+
734
+ age : 22
735
+ ssn : 111-22-3333
736
+ house_number : 221B
737
+
738
+ """
739
+ if self._name:
740
+ return self._name
741
+ elif self._parent:
742
+ par: ParseResults = self._parent
743
+ parent_tokdict_items = par._tokdict.items()
744
+ return next(
745
+ (
746
+ k
747
+ for k, vlist in parent_tokdict_items
748
+ for v, loc in vlist
749
+ if v is self
750
+ ),
751
+ None,
752
+ )
753
+ elif (
754
+ len(self) == 1
755
+ and len(self._tokdict) == 1
756
+ and next(iter(self._tokdict.values()))[0][1] in (0, -1)
757
+ ):
758
+ return next(iter(self._tokdict.keys()))
759
+ else:
760
+ return None
761
+
762
+ def dump(self, indent="", full=True, include_list=True, _depth=0) -> str:
763
+ """
764
+ Diagnostic method for listing out the contents of
765
+ a :class:`ParseResults`. Accepts an optional ``indent`` argument so
766
+ that this string can be embedded in a nested display of other data.
767
+
768
+ Example:
769
+
770
+ .. testcode::
771
+
772
+ integer = Word(nums)
773
+ date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
774
+
775
+ result = date_str.parse_string('1999/12/31')
776
+ print(result.dump())
777
+
778
+ prints:
779
+
780
+ .. testoutput::
781
+
782
+ ['1999', '/', '12', '/', '31']
783
+ - day: '31'
784
+ - month: '12'
785
+ - year: '1999'
786
+ """
787
+ out = []
788
+ NL = "\n"
789
+ out.append(indent + str(self.as_list()) if include_list else "")
790
+
791
+ if not full:
792
+ return "".join(out)
793
+
794
+ if self.haskeys():
795
+ items = sorted((str(k), v) for k, v in self.items())
796
+ for k, v in items:
797
+ if out:
798
+ out.append(NL)
799
+ out.append(f"{indent}{(' ' * _depth)}- {k}: ")
800
+ if not isinstance(v, ParseResults):
801
+ out.append(repr(v))
802
+ continue
803
+
804
+ if not v:
805
+ out.append(str(v))
806
+ continue
807
+
808
+ out.append(
809
+ v.dump(
810
+ indent=indent,
811
+ full=full,
812
+ include_list=include_list,
813
+ _depth=_depth + 1,
814
+ )
815
+ )
816
+ if not any(isinstance(vv, ParseResults) for vv in self):
817
+ return "".join(out)
818
+
819
+ v = self
820
+ incr = " "
821
+ nl = "\n"
822
+ for i, vv in enumerate(v):
823
+ if isinstance(vv, ParseResults):
824
+ vv_dump = vv.dump(
825
+ indent=indent,
826
+ full=full,
827
+ include_list=include_list,
828
+ _depth=_depth + 1,
829
+ )
830
+ out.append(
831
+ f"{nl}{indent}{incr * _depth}[{i}]:{nl}{indent}{incr * (_depth + 1)}{vv_dump}"
832
+ )
833
+ else:
834
+ out.append(
835
+ f"{nl}{indent}{incr * _depth}[{i}]:{nl}{indent}{incr * (_depth + 1)}{vv}"
836
+ )
837
+
838
+ return "".join(out)
839
+
840
+ def pprint(self, *args, **kwargs):
841
+ """
842
+ Pretty-printer for parsed results as a list, using the
843
+ `pprint <https://docs.python.org/3/library/pprint.html>`_ module.
844
+ Accepts additional positional or keyword args as defined for
845
+ `pprint.pprint <https://docs.python.org/3/library/pprint.html#pprint.pprint>`_ .
846
+
847
+ Example:
848
+
849
+ .. testcode::
850
+
851
+ ident = Word(alphas, alphanums)
852
+ num = Word(nums)
853
+ func = Forward()
854
+ term = ident | num | Group('(' + func + ')')
855
+ func <<= ident + Group(Optional(DelimitedList(term)))
856
+ result = func.parse_string("fna a,b,(fnb c,d,200),100")
857
+ result.pprint(width=40)
858
+
859
+ prints:
860
+
861
+ .. testoutput::
862
+
863
+ ['fna',
864
+ ['a',
865
+ 'b',
866
+ ['(', 'fnb', ['c', 'd', '200'], ')'],
867
+ '100']]
868
+ """
869
+ pprint.pprint(self.as_list(), *args, **kwargs)
870
+
871
+ # add support for pickle protocol
872
+ def __getstate__(self):
873
+ return (
874
+ self._toklist,
875
+ (
876
+ self._tokdict.copy(),
877
+ None,
878
+ self._all_names,
879
+ self._name,
880
+ ),
881
+ )
882
+
883
+ def __setstate__(self, state):
884
+ self._toklist, (self._tokdict, par, inAccumNames, self._name) = state
885
+ self._all_names = set(inAccumNames)
886
+ self._parent = None
887
+
888
+ def __getnewargs__(self):
889
+ return self._toklist, self._name
890
+
891
+ def __dir__(self):
892
+ return dir(type(self)) + list(self.keys())
893
+
894
+ @classmethod
895
+ def from_dict(cls, other, name=None) -> ParseResults:
896
+ """
897
+ Helper classmethod to construct a :class:`ParseResults` from a ``dict``, preserving the
898
+ name-value relations as results names. If an optional ``name`` argument is
899
+ given, a nested :class:`ParseResults` will be returned.
900
+ """
901
+ ret = cls([])
902
+ for k, v in other.items():
903
+ if isinstance(v, Mapping):
904
+ ret += cls.from_dict(v, name=k)
905
+ else:
906
+ ret += cls([v], name=k, aslist=_is_iterable(v))
907
+ if name is not None:
908
+ ret = cls([ret], name=name)
909
+ return ret
910
+
911
+ asList = as_list
912
+ """
913
+ .. deprecated:: 3.0.0
914
+ use :meth:`as_list`
915
+ """
916
+ asDict = as_dict
917
+ """
918
+ .. deprecated:: 3.0.0
919
+ use :meth:`as_dict`
920
+ """
921
+ getName = get_name
922
+ """
923
+ .. deprecated:: 3.0.0
924
+ use :meth:`get_name`
925
+ """
926
+
927
+
928
+ MutableMapping.register(ParseResults)
929
+ MutableSequence.register(ParseResults)