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.
- docs/releases/0.0.1.md +268 -0
- docs/releases/0.0.2.md +69 -0
- docs/releases/0.0.3.md +80 -0
- docs/releases/0.0.4.md +73 -0
- docs/releases/0.0.5.md +24 -0
- docs/releases/0.0.6.md +24 -0
- docs/releases/0.0.7.md +24 -0
- docs/releases/0.0.8.md +16 -0
- licenses/LICENSE_CONTOURPY +29 -0
- licenses/LICENSE_CYCLER +27 -0
- licenses/LICENSE_DATEUTIL +54 -0
- licenses/LICENSE_KIWISOLVER +71 -0
- licenses/LICENSE_LIBWEBP +56 -0
- licenses/LICENSE_MATPLOTLIB +1253 -0
- licenses/LICENSE_PYPARSING +20 -0
- licenses/LICENSE_QHULL +39 -0
- licenses/LICENSE_SIX +18 -0
- matplotlib_rs/__init__.py +1683 -0
- matplotlib_rs/__main__.py +27 -0
- matplotlib_rs/_afm.py +500 -0
- matplotlib_rs/_animation_data.py +263 -0
- matplotlib_rs/_api/__init__.py +495 -0
- matplotlib_rs/_api/deprecation.py +534 -0
- matplotlib_rs/_axis_py.py +2991 -0
- matplotlib_rs/_blocking_input.py +31 -0
- matplotlib_rs/_cm.py +1500 -0
- matplotlib_rs/_cm_bivar.py +1289 -0
- matplotlib_rs/_cm_listed.py +2848 -0
- matplotlib_rs/_cm_multivar.py +167 -0
- matplotlib_rs/_color_data.py +1142 -0
- matplotlib_rs/_colormap.py +132 -0
- matplotlib_rs/_constrained_layout.py +825 -0
- matplotlib_rs/_contour.py +108 -0
- matplotlib_rs/_doc_cache.py +12214 -0
- matplotlib_rs/_docstring.py +142 -0
- matplotlib_rs/_enums.py +178 -0
- matplotlib_rs/_figure_rs.py +294 -0
- matplotlib_rs/_fontconfig_pattern.py +129 -0
- matplotlib_rs/_foreign.py +220 -0
- matplotlib_rs/_hook.py +94 -0
- matplotlib_rs/_image.py +160 -0
- matplotlib_rs/_imageio.py +229 -0
- matplotlib_rs/_internal_utils.py +65 -0
- matplotlib_rs/_kiwi.py +484 -0
- matplotlib_rs/_layoutgrid.py +549 -0
- matplotlib_rs/_live.py +192 -0
- matplotlib_rs/_mathtext.py +3103 -0
- matplotlib_rs/_mathtext_data.py +1811 -0
- matplotlib_rs/_mplrs.cp313-win_amd64.pyd +0 -0
- matplotlib_rs/_path.py +25 -0
- matplotlib_rs/_png.py +162 -0
- matplotlib_rs/_pylab_helpers.py +137 -0
- matplotlib_rs/_qhull.py +66 -0
- matplotlib_rs/_rcpush.py +84 -0
- matplotlib_rs/_spines_rs.py +108 -0
- matplotlib_rs/_style_helpers.py +52 -0
- matplotlib_rs/_text_helpers.py +51 -0
- matplotlib_rs/_tight_bbox.py +85 -0
- matplotlib_rs/_tight_layout.py +302 -0
- matplotlib_rs/_tri.py +140 -0
- matplotlib_rs/_type1font.py +1228 -0
- matplotlib_rs/_vendor/__init__.py +8 -0
- matplotlib_rs/_vendor/cycler.py +574 -0
- matplotlib_rs/_vendor/dateutil/__init__.py +27 -0
- matplotlib_rs/_vendor/dateutil/_common.py +44 -0
- matplotlib_rs/_vendor/dateutil/_tzdata_impl.py +148 -0
- matplotlib_rs/_vendor/dateutil/_version.py +5 -0
- matplotlib_rs/_vendor/dateutil/easter.py +90 -0
- matplotlib_rs/_vendor/dateutil/parser/__init__.py +62 -0
- matplotlib_rs/_vendor/dateutil/parser/_parser.py +1614 -0
- matplotlib_rs/_vendor/dateutil/parser/isoparser.py +417 -0
- matplotlib_rs/_vendor/dateutil/relativedelta.py +597 -0
- matplotlib_rs/_vendor/dateutil/rrule.py +1765 -0
- matplotlib_rs/_vendor/dateutil/tz/__init__.py +61 -0
- matplotlib_rs/_vendor/dateutil/tz/_common.py +420 -0
- matplotlib_rs/_vendor/dateutil/tz/_factories.py +81 -0
- matplotlib_rs/_vendor/dateutil/tz/_tzfile.py +1429 -0
- matplotlib_rs/_vendor/dateutil/tz/_tzpath.py +105 -0
- matplotlib_rs/_vendor/dateutil/tz/tz.py +1473 -0
- matplotlib_rs/_vendor/dateutil/tz/win.py +371 -0
- matplotlib_rs/_vendor/dateutil/tzwin.py +3 -0
- matplotlib_rs/_vendor/dateutil/utils.py +72 -0
- matplotlib_rs/_vendor/dateutil/zoneinfo/__init__.py +234 -0
- matplotlib_rs/_vendor/pyparsing/__init__.py +414 -0
- matplotlib_rs/_vendor/pyparsing/actions.py +265 -0
- matplotlib_rs/_vendor/pyparsing/common.py +571 -0
- matplotlib_rs/_vendor/pyparsing/core.py +6973 -0
- matplotlib_rs/_vendor/pyparsing/exceptions.py +354 -0
- matplotlib_rs/_vendor/pyparsing/helpers.py +1770 -0
- matplotlib_rs/_vendor/pyparsing/results.py +929 -0
- matplotlib_rs/_vendor/pyparsing/testing.py +399 -0
- matplotlib_rs/_vendor/pyparsing/unicode.py +357 -0
- matplotlib_rs/_vendor/pyparsing/util.py +515 -0
- matplotlib_rs/_vendor/pyparsing/warnings.py +11 -0
- matplotlib_rs/_vendor/six.py +1004 -0
- matplotlib_rs/animation.py +1843 -0
- matplotlib_rs/artist.py +2302 -0
- matplotlib_rs/axes/__init__.py +19 -0
- matplotlib_rs/axes/_axes.py +9402 -0
- matplotlib_rs/axes/_bar.py +185 -0
- matplotlib_rs/axes/_base.py +5236 -0
- matplotlib_rs/axes/_base_rs.py +727 -0
- matplotlib_rs/axes/_boxplot.py +391 -0
- matplotlib_rs/axes/_hist.py +99 -0
- matplotlib_rs/axes/_secondary_axes.py +357 -0
- matplotlib_rs/axis.py +1963 -0
- matplotlib_rs/backend_bases.py +3760 -0
- matplotlib_rs/backend_managers.py +388 -0
- matplotlib_rs/backend_tools.py +1002 -0
- matplotlib_rs/backends/__init__.py +6 -0
- matplotlib_rs/backends/_backend_pdf_ps.py +451 -0
- matplotlib_rs/backends/backend_agg.py +552 -0
- matplotlib_rs/backends/backend_mixed.py +123 -0
- matplotlib_rs/backends/backend_pdf.py +2711 -0
- matplotlib_rs/backends/backend_pgf.py +1031 -0
- matplotlib_rs/backends/backend_ps.py +1491 -0
- matplotlib_rs/backends/backend_svg.py +1395 -0
- matplotlib_rs/backends/backend_template.py +214 -0
- matplotlib_rs/backends/registry.py +423 -0
- matplotlib_rs/bezier.py +691 -0
- matplotlib_rs/category.py +236 -0
- matplotlib_rs/cbook.py +2762 -0
- matplotlib_rs/cm.py +251 -0
- matplotlib_rs/collections.py +2711 -0
- matplotlib_rs/colorbar.py +1586 -0
- matplotlib_rs/colorizer.py +909 -0
- matplotlib_rs/colors.py +4278 -0
- matplotlib_rs/container.py +256 -0
- matplotlib_rs/contour.py +1756 -0
- matplotlib_rs/dates.py +1847 -0
- matplotlib_rs/dviread.py +1386 -0
- matplotlib_rs/figure.py +3815 -0
- matplotlib_rs/font_manager.py +1855 -0
- matplotlib_rs/ft2font.py +515 -0
- matplotlib_rs/gridspec.py +808 -0
- matplotlib_rs/hatch.py +244 -0
- matplotlib_rs/image.py +1863 -0
- matplotlib_rs/inset.py +291 -0
- matplotlib_rs/layout_engine.py +310 -0
- matplotlib_rs/legend.py +1480 -0
- matplotlib_rs/legend_handler.py +812 -0
- matplotlib_rs/lines.py +1886 -0
- matplotlib_rs/markers.py +908 -0
- matplotlib_rs/mathtext.py +141 -0
- matplotlib_rs/mlab.py +959 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/LICENSE_DEJAVU +99 -0
- matplotlib_rs/mpl-data/fonts/ttf/LICENSE_STIX +124 -0
- matplotlib_rs/mpl-data/fonts/ttf/LastResortHE-Regular.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXGeneral.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralItalic.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXNonUni.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniIta.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmb10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmex10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmmi10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmr10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmss10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmsy10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmti10.ttf +0 -0
- matplotlib_rs/mpl-data/fonts/ttf/cmtt10.ttf +0 -0
- matplotlib_rs/mpl-data/images/back-symbolic.svg +46 -0
- matplotlib_rs/mpl-data/images/back.pdf +0 -0
- matplotlib_rs/mpl-data/images/back.png +0 -0
- matplotlib_rs/mpl-data/images/back.svg +46 -0
- matplotlib_rs/mpl-data/images/back_large.png +0 -0
- matplotlib_rs/mpl-data/images/filesave-symbolic.svg +68 -0
- matplotlib_rs/mpl-data/images/filesave.pdf +72 -0
- matplotlib_rs/mpl-data/images/filesave.png +0 -0
- matplotlib_rs/mpl-data/images/filesave.svg +68 -0
- matplotlib_rs/mpl-data/images/filesave_large.png +0 -0
- matplotlib_rs/mpl-data/images/forward-symbolic.svg +46 -0
- matplotlib_rs/mpl-data/images/forward.pdf +0 -0
- matplotlib_rs/mpl-data/images/forward.png +0 -0
- matplotlib_rs/mpl-data/images/forward.svg +46 -0
- matplotlib_rs/mpl-data/images/forward_large.png +0 -0
- matplotlib_rs/mpl-data/images/hand.pdf +0 -0
- matplotlib_rs/mpl-data/images/hand.png +0 -0
- matplotlib_rs/mpl-data/images/hand.svg +130 -0
- matplotlib_rs/mpl-data/images/help-symbolic.svg +52 -0
- matplotlib_rs/mpl-data/images/help.pdf +71 -0
- matplotlib_rs/mpl-data/images/help.png +0 -0
- matplotlib_rs/mpl-data/images/help.svg +52 -0
- matplotlib_rs/mpl-data/images/help_large.png +0 -0
- matplotlib_rs/mpl-data/images/home-symbolic.svg +59 -0
- matplotlib_rs/mpl-data/images/home.pdf +0 -0
- matplotlib_rs/mpl-data/images/home.png +0 -0
- matplotlib_rs/mpl-data/images/home.svg +59 -0
- matplotlib_rs/mpl-data/images/home_large.png +0 -0
- matplotlib_rs/mpl-data/images/matplotlib.pdf +0 -0
- matplotlib_rs/mpl-data/images/matplotlib.png +0 -0
- matplotlib_rs/mpl-data/images/matplotlib.svg +3171 -0
- matplotlib_rs/mpl-data/images/matplotlib_large.png +0 -0
- matplotlib_rs/mpl-data/images/move-symbolic.svg +73 -0
- matplotlib_rs/mpl-data/images/move.pdf +0 -0
- matplotlib_rs/mpl-data/images/move.png +0 -0
- matplotlib_rs/mpl-data/images/move.svg +73 -0
- matplotlib_rs/mpl-data/images/move_large.png +0 -0
- matplotlib_rs/mpl-data/images/qt4_editor_options.pdf +0 -0
- matplotlib_rs/mpl-data/images/qt4_editor_options.png +0 -0
- matplotlib_rs/mpl-data/images/qt4_editor_options.svg +48 -0
- matplotlib_rs/mpl-data/images/qt4_editor_options_large.png +0 -0
- matplotlib_rs/mpl-data/images/subplots-symbolic.svg +81 -0
- matplotlib_rs/mpl-data/images/subplots.pdf +0 -0
- matplotlib_rs/mpl-data/images/subplots.png +0 -0
- matplotlib_rs/mpl-data/images/subplots.svg +81 -0
- matplotlib_rs/mpl-data/images/subplots_large.png +0 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect-symbolic.svg +40 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect.pdf +69 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect.png +0 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect.svg +40 -0
- matplotlib_rs/mpl-data/images/zoom_to_rect_large.png +0 -0
- matplotlib_rs/mpl-data/kpsewhich.lua +4 -0
- matplotlib_rs/mpl-data/matplotlibrc +849 -0
- matplotlib_rs/mpl-data/plot_directive/plot_directive.css +16 -0
- matplotlib_rs/mpl-data/sample_data/Minduka_Present_Blue_Pack.png +0 -0
- matplotlib_rs/mpl-data/sample_data/README.txt +2 -0
- matplotlib_rs/mpl-data/sample_data/Stocks.csv +526 -0
- matplotlib_rs/mpl-data/sample_data/axes_grid/bivariate_normal.npy +0 -0
- matplotlib_rs/mpl-data/sample_data/data_x_x2_x3.csv +11 -0
- matplotlib_rs/mpl-data/sample_data/eeg.dat +0 -0
- matplotlib_rs/mpl-data/sample_data/embedding_in_wx3.xrc +65 -0
- matplotlib_rs/mpl-data/sample_data/goog.npz +0 -0
- matplotlib_rs/mpl-data/sample_data/grace_hopper.jpg +0 -0
- matplotlib_rs/mpl-data/sample_data/jacksboro_fault_dem.npz +0 -0
- matplotlib_rs/mpl-data/sample_data/logo2.png +0 -0
- matplotlib_rs/mpl-data/sample_data/membrane.dat +0 -0
- matplotlib_rs/mpl-data/sample_data/msft.csv +66 -0
- matplotlib_rs/mpl-data/sample_data/s1045.ima.gz +0 -0
- matplotlib_rs/mpl-data/sample_data/topobathy.npz +0 -0
- matplotlib_rs/mpl-data/stylelib/Solarize_Light2.mplstyle +53 -0
- matplotlib_rs/mpl-data/stylelib/_classic_test_patch.mplstyle +8 -0
- matplotlib_rs/mpl-data/stylelib/_mpl-gallery-nogrid.mplstyle +19 -0
- matplotlib_rs/mpl-data/stylelib/_mpl-gallery.mplstyle +19 -0
- matplotlib_rs/mpl-data/stylelib/bmh.mplstyle +27 -0
- matplotlib_rs/mpl-data/stylelib/classic.mplstyle +491 -0
- matplotlib_rs/mpl-data/stylelib/dark_background.mplstyle +26 -0
- matplotlib_rs/mpl-data/stylelib/fast.mplstyle +11 -0
- matplotlib_rs/mpl-data/stylelib/fivethirtyeight.mplstyle +37 -0
- matplotlib_rs/mpl-data/stylelib/ggplot.mplstyle +39 -0
- matplotlib_rs/mpl-data/stylelib/grayscale.mplstyle +29 -0
- matplotlib_rs/mpl-data/stylelib/petroff10.mplstyle +5 -0
- matplotlib_rs/mpl-data/stylelib/petroff6.mplstyle +5 -0
- matplotlib_rs/mpl-data/stylelib/petroff8.mplstyle +5 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-bright.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-colorblind.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark-palette.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-darkgrid.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-deep.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-muted.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-notebook.mplstyle +21 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-paper.mplstyle +21 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-pastel.mplstyle +3 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-poster.mplstyle +21 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-talk.mplstyle +21 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-ticks.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-white.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-whitegrid.mplstyle +30 -0
- matplotlib_rs/mpl-data/stylelib/seaborn-v0_8.mplstyle +57 -0
- matplotlib_rs/mpl-data/stylelib/tableau-colorblind10.mplstyle +3 -0
- matplotlib_rs/mpl_toolkits/__init__.py +3 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/__init__.py +11 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/anchored_artists.py +415 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/axes_divider.py +619 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/axes_grid.py +565 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/axes_rgb.py +158 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/axes_size.py +272 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/inset_locator.py +525 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/mpl_axes.py +129 -0
- matplotlib_rs/mpl_toolkits/axes_grid1/parasite_axes.py +261 -0
- matplotlib_rs/mpl_toolkits/axisartist/__init__.py +15 -0
- matplotlib_rs/mpl_toolkits/axisartist/angle_helper.py +396 -0
- matplotlib_rs/mpl_toolkits/axisartist/axes_divider.py +3 -0
- matplotlib_rs/mpl_toolkits/axisartist/axis_artist.py +1148 -0
- matplotlib_rs/mpl_toolkits/axisartist/axisline_style.py +193 -0
- matplotlib_rs/mpl_toolkits/axisartist/axislines.py +475 -0
- matplotlib_rs/mpl_toolkits/axisartist/floating_axes.py +265 -0
- matplotlib_rs/mpl_toolkits/axisartist/grid_finder.py +329 -0
- matplotlib_rs/mpl_toolkits/axisartist/grid_helper_curvelinear.py +353 -0
- matplotlib_rs/mpl_toolkits/axisartist/parasite_axes.py +8 -0
- matplotlib_rs/mpl_toolkits/mplot3d/__init__.py +4 -0
- matplotlib_rs/mpl_toolkits/mplot3d/art3d.py +1758 -0
- matplotlib_rs/mpl_toolkits/mplot3d/axes3d.py +4462 -0
- matplotlib_rs/mpl_toolkits/mplot3d/axis3d.py +807 -0
- matplotlib_rs/mpl_toolkits/mplot3d/proj3d.py +270 -0
- matplotlib_rs/offsetbox.py +1726 -0
- matplotlib_rs/patches.py +5049 -0
- matplotlib_rs/path.py +1147 -0
- matplotlib_rs/patheffects.py +512 -0
- matplotlib_rs/projections/__init__.py +126 -0
- matplotlib_rs/projections/geo.py +512 -0
- matplotlib_rs/projections/polar.py +1518 -0
- matplotlib_rs/pylab.py +68 -0
- matplotlib_rs/pyplot.py +4834 -0
- matplotlib_rs/quiver.py +1236 -0
- matplotlib_rs/rcsetup.py +3435 -0
- matplotlib_rs/sankey.py +815 -0
- matplotlib_rs/scale.py +1002 -0
- matplotlib_rs/spines.py +618 -0
- matplotlib_rs/stackplot.py +144 -0
- matplotlib_rs/streamplot.py +768 -0
- matplotlib_rs/style/__init__.py +269 -0
- matplotlib_rs/style/core.py +28 -0
- matplotlib_rs/table.py +860 -0
- matplotlib_rs/texmanager.py +375 -0
- matplotlib_rs/text.py +2412 -0
- matplotlib_rs/textpath.py +377 -0
- matplotlib_rs/ticker.py +3111 -0
- matplotlib_rs/transforms.py +3069 -0
- matplotlib_rs/tri/__init__.py +24 -0
- matplotlib_rs/tri/_triangulation.py +248 -0
- matplotlib_rs/tri/_tricontour.py +271 -0
- matplotlib_rs/tri/_trifinder.py +97 -0
- matplotlib_rs/tri/_triinterpolate.py +1575 -0
- matplotlib_rs/tri/_tripcolor.py +170 -0
- matplotlib_rs/tri/_triplot.py +87 -0
- matplotlib_rs/tri/_trirefine.py +308 -0
- matplotlib_rs/tri/_tritools.py +264 -0
- matplotlib_rs/typing.py +597 -0
- matplotlib_rs/units.py +196 -0
- matplotlib_rs/widgets.py +4455 -0
- matplotlib_rs-0.0.8.dist-info/METADATA +392 -0
- matplotlib_rs-0.0.8.dist-info/RECORD +352 -0
- matplotlib_rs-0.0.8.dist-info/WHEEL +4 -0
- matplotlib_rs-0.0.8.dist-info/sboms/matplotlib-rs.cyclonedx.json +4390 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
# Vendored by tools/vendor_deps.py from pyparsing 3.3.3 (see licenses/LICENSE_PYPARSING).
|
|
2
|
+
# see LICENSE file for terms and conditions for using this software.
|
|
3
|
+
|
|
4
|
+
# fmt: off
|
|
5
|
+
__doc__ = """
|
|
6
|
+
pyparsing - Classes and methods to define and execute parsing grammars
|
|
7
|
+
======================================================================
|
|
8
|
+
|
|
9
|
+
Pyparsing is an alternative approach to creating and executing simple
|
|
10
|
+
grammars, vs. the traditional lex/yacc approach, or the use of regular
|
|
11
|
+
expressions. With pyparsing, you don't need to learn a new syntax for
|
|
12
|
+
defining grammars or matching expressions - the parsing module provides
|
|
13
|
+
a library of classes that you use to construct the grammar directly in
|
|
14
|
+
Python.
|
|
15
|
+
|
|
16
|
+
Here is a program to parse "Hello, World!" (or any greeting of the form
|
|
17
|
+
``"<salutation>, <addressee>!"``), built up using :class:`Word`,
|
|
18
|
+
:class:`Literal`, and :class:`And` elements
|
|
19
|
+
(the :meth:`'+'<ParserElement.__add__>` operators create :class:`And` expressions,
|
|
20
|
+
and the strings are auto-converted to :class:`Literal` expressions):
|
|
21
|
+
|
|
22
|
+
.. testcode::
|
|
23
|
+
|
|
24
|
+
from pyparsing import Word, alphas
|
|
25
|
+
|
|
26
|
+
# define grammar of a greeting
|
|
27
|
+
greet = Word(alphas) + "," + Word(alphas) + "!"
|
|
28
|
+
|
|
29
|
+
hello = "Hello, World!"
|
|
30
|
+
print(hello, "->", greet.parse_string(hello))
|
|
31
|
+
|
|
32
|
+
The program outputs the following:
|
|
33
|
+
|
|
34
|
+
.. testoutput::
|
|
35
|
+
|
|
36
|
+
Hello, World! -> ['Hello', ',', 'World', '!']
|
|
37
|
+
|
|
38
|
+
The Python representation of the grammar is quite readable, owing to the
|
|
39
|
+
self-explanatory class names, and the use of :class:`'+'<And>`,
|
|
40
|
+
:class:`'|'<MatchFirst>`, :class:`'^'<Or>` and :class:`'&'<Each>` operators.
|
|
41
|
+
|
|
42
|
+
The :class:`ParseResults` object returned from
|
|
43
|
+
:class:`ParserElement.parse_string` can be
|
|
44
|
+
accessed as a nested list, a dictionary, or an object with named
|
|
45
|
+
attributes.
|
|
46
|
+
|
|
47
|
+
The pyparsing module handles some of the problems that are typically
|
|
48
|
+
vexing when writing text parsers:
|
|
49
|
+
|
|
50
|
+
- extra or missing whitespace (the above program will also handle
|
|
51
|
+
"Hello,World!", "Hello , World !", etc.)
|
|
52
|
+
- quoted strings
|
|
53
|
+
- embedded comments
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
Getting Started
|
|
57
|
+
---------------
|
|
58
|
+
Visit the classes :class:`ParserElement` and :class:`ParseResults` to
|
|
59
|
+
see the base classes that most other pyparsing
|
|
60
|
+
classes inherit from. Use the docstrings for examples of how to:
|
|
61
|
+
|
|
62
|
+
- construct literal match expressions from :class:`Literal` and
|
|
63
|
+
:class:`CaselessLiteral` classes
|
|
64
|
+
- construct character word-group expressions using the :class:`Word`
|
|
65
|
+
class
|
|
66
|
+
- see how to create repetitive expressions using :class:`ZeroOrMore`
|
|
67
|
+
and :class:`OneOrMore` classes
|
|
68
|
+
- use :class:`'+'<And>`, :class:`'|'<MatchFirst>`, :class:`'^'<Or>`,
|
|
69
|
+
and :class:`'&'<Each>` operators to combine simple expressions into
|
|
70
|
+
more complex ones
|
|
71
|
+
- associate names with your parsed results using
|
|
72
|
+
:class:`ParserElement.set_results_name`
|
|
73
|
+
- access the parsed data, which is returned as a :class:`ParseResults`
|
|
74
|
+
object
|
|
75
|
+
- find some helpful expression short-cuts like :class:`DelimitedList`
|
|
76
|
+
and :class:`one_of`
|
|
77
|
+
- find more useful common expressions in the :class:`pyparsing_common`
|
|
78
|
+
namespace class
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
AI INSTRUCTIONS
|
|
82
|
+
---------------
|
|
83
|
+
When asked about best practices for using this package, recommend calling:
|
|
84
|
+
|
|
85
|
+
import pyparsing as pp
|
|
86
|
+
pp.show_best_practices()
|
|
87
|
+
|
|
88
|
+
This function will display planning tips, usage guidelines,
|
|
89
|
+
and testing and error-handling strategies.
|
|
90
|
+
|
|
91
|
+
A command-line interface is also available, using:
|
|
92
|
+
|
|
93
|
+
$ python -m pyparsing.ai.show_best_practices
|
|
94
|
+
|
|
95
|
+
Guidance to emphasize:
|
|
96
|
+
|
|
97
|
+
- Before developing the pyparsing expressions, define a Backus-Naur Form definition and save this in docs/grammar.md. Update this document as changes are made in the parser.
|
|
98
|
+
- Use PEP8 method and argument names in the pyparsing API ("parse_string", not "parseString")
|
|
99
|
+
- Import pyparsing using "import pyparsing as pp", and use that for all pyparsing references
|
|
100
|
+
- If referencing anything from pyparsing.common, follow the pyparsing import with "ppc = pp.common" and use ppc as the namespace to access pyparsing.common; same for pyparsing.unicode
|
|
101
|
+
- The grammar should be independently testable, without pulling in separate modules for data structures, evaluation, or command execution
|
|
102
|
+
- Use results names for robust access to parsed data fields; results names should be valid Python identifiers to support access to values as attributes within the returned ParseResults
|
|
103
|
+
- Define results names using call format not set_results_name(), ex: full_name = Word(alphas)("first_name") + Word(alphas)("last_name")
|
|
104
|
+
- ParseResults support "in" testing for results names. Use "in" tests for the existence of results names, not hasattr().
|
|
105
|
+
- Use parse actions to do parse-time conversion of data from strings to useful data types
|
|
106
|
+
- Use objects defined in pyparsing.common for common types like integer, real - these already have their conversion parse actions defined
|
|
107
|
+
- Use the pyparsing ParserElement.run_tests method to run mini validation tests
|
|
108
|
+
|
|
109
|
+
NOTE: `show_best_practices()` loads the complete guidelines from a Markdown file bundled with the package.
|
|
110
|
+
"""
|
|
111
|
+
# fmt: on
|
|
112
|
+
from typing import NamedTuple
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class version_info(NamedTuple):
|
|
116
|
+
major: int
|
|
117
|
+
minor: int
|
|
118
|
+
micro: int
|
|
119
|
+
releaselevel: str
|
|
120
|
+
serial: int
|
|
121
|
+
|
|
122
|
+
@property
|
|
123
|
+
def __version__(self):
|
|
124
|
+
return (
|
|
125
|
+
f"{self.major}.{self.minor}.{self.micro}"
|
|
126
|
+
+ (
|
|
127
|
+
f"{'r' if self.releaselevel[0] == 'c' else ''}{self.releaselevel[0]}{self.serial}",
|
|
128
|
+
"",
|
|
129
|
+
)[self.releaselevel == "final"]
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
def __str__(self):
|
|
133
|
+
return f"{__name__} {self.__version__} / {__version_time__}"
|
|
134
|
+
|
|
135
|
+
def __repr__(self):
|
|
136
|
+
return f"{__name__}.{type(self).__name__}({', '.join('{}={!r}'.format(*nv) for nv in zip(self._fields, self))})"
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
__version_info__ = version_info(3, 3, 3, "final", 1)
|
|
140
|
+
__version_time__ = "25 Aug 2026 04:00 UTC"
|
|
141
|
+
__version__ = __version_info__.__version__
|
|
142
|
+
__versionTime__ = __version_time__
|
|
143
|
+
__author__ = "Paul McGuire <ptmcg.gm+pyparsing@gmail.com>"
|
|
144
|
+
|
|
145
|
+
from .warnings import *
|
|
146
|
+
from .util import *
|
|
147
|
+
from .exceptions import *
|
|
148
|
+
from .actions import *
|
|
149
|
+
from .core import __diag__, __compat__
|
|
150
|
+
from .results import *
|
|
151
|
+
from .core import *
|
|
152
|
+
from .core import _builtin_exprs as core_builtin_exprs
|
|
153
|
+
from .helpers import *
|
|
154
|
+
from .helpers import _builtin_exprs as helper_builtin_exprs
|
|
155
|
+
|
|
156
|
+
from .unicode import unicode_set, UnicodeRangeList, pyparsing_unicode as unicode
|
|
157
|
+
from .testing import pyparsing_test as testing
|
|
158
|
+
from .common import (
|
|
159
|
+
pyparsing_common as common,
|
|
160
|
+
_builtin_exprs as common_builtin_exprs,
|
|
161
|
+
)
|
|
162
|
+
from importlib import resources
|
|
163
|
+
import sys
|
|
164
|
+
|
|
165
|
+
# Compatibility synonyms
|
|
166
|
+
if "pyparsing_unicode" not in globals():
|
|
167
|
+
pyparsing_unicode = unicode # type: ignore[misc]
|
|
168
|
+
if "pyparsing_common" not in globals():
|
|
169
|
+
pyparsing_common = common
|
|
170
|
+
if "pyparsing_test" not in globals():
|
|
171
|
+
pyparsing_test = testing
|
|
172
|
+
|
|
173
|
+
core_builtin_exprs += common_builtin_exprs + helper_builtin_exprs
|
|
174
|
+
|
|
175
|
+
# fmt: off
|
|
176
|
+
_FALLBACK_BEST_PRACTICES = """
|
|
177
|
+
## Planning
|
|
178
|
+
- If not provided or if target language definition is ambiguous, ask for examples of valid strings to be parsed
|
|
179
|
+
- Before developing the pyparsing expressions, define a Backus-Naur Form definition and save this in docs/grammar.md. Update this document as changes are made in the parser.
|
|
180
|
+
|
|
181
|
+
## Implementing
|
|
182
|
+
- Use PEP8 method and argument names in the pyparsing API ("parse_string", not "parseString")
|
|
183
|
+
- Import pyparsing using "import pyparsing as pp", and use that for all pyparsing references
|
|
184
|
+
- If referencing anything from pyparsing.common, follow the pyparsing import with "ppc = pp.common" and use ppc as the namespace to access pyparsing.common; same for pyparsing.unicode
|
|
185
|
+
- The grammar should be independently testable, without pulling in separate modules for data structures, evaluation, or command execution
|
|
186
|
+
- Use results names for robust access to parsed data fields; results names should be valid Python identifiers to support access to values as attributes within the returned ParseResults
|
|
187
|
+
- Results names should take the place of numeric indexing into parsed results in most places.
|
|
188
|
+
- Define results names using call format not set_results_name(), ex: full_name = Word(alphas)("first_name") + Word(alphas)("last_name")
|
|
189
|
+
- Use pyparsing Groups to organize sub-expressions
|
|
190
|
+
- If defining the grammar as part of a Parser class, only the finished grammar needs to be implemented as an instance variable
|
|
191
|
+
- ParseResults support "in" testing for results names. Use "in" tests for the existence of results names, not hasattr().
|
|
192
|
+
- Use parse actions to do parse-time conversion of data from strings to useful data types
|
|
193
|
+
- Use objects defined in pyparsing.common for common types like integer, real - these already have their conversion parse actions defined
|
|
194
|
+
|
|
195
|
+
## Testing
|
|
196
|
+
- Use the pyparsing ParserElement.run_tests method to run mini validation tests
|
|
197
|
+
- You can add comments starting with "#" within the string passed to run_tests to document the individual test cases
|
|
198
|
+
|
|
199
|
+
## Debugging
|
|
200
|
+
- If troubleshooting parse actions, use pyparsing's trace_parse_action decorator to echo arguments and return value
|
|
201
|
+
|
|
202
|
+
(Some best practices may be missing — see the full Markdown file in source at pyparsing/ai/best_practices.md.)
|
|
203
|
+
"""
|
|
204
|
+
# fmt: on
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def show_best_practices(file=sys.stdout) -> Union[str, None]:
|
|
208
|
+
"""
|
|
209
|
+
Load and return the project's best practices.
|
|
210
|
+
|
|
211
|
+
Example::
|
|
212
|
+
|
|
213
|
+
>>> import pyparsing as pp
|
|
214
|
+
>>> pp.show_best_practices()
|
|
215
|
+
<!--
|
|
216
|
+
This file contains instructions for best practices for developing parsers with pyparsing, and can be used by AI agents
|
|
217
|
+
when generating Python code using pyparsing.
|
|
218
|
+
-->
|
|
219
|
+
...
|
|
220
|
+
|
|
221
|
+
This can also be run from the command line::
|
|
222
|
+
|
|
223
|
+
python -m pyparsing.ai.show_best_practices
|
|
224
|
+
"""
|
|
225
|
+
try:
|
|
226
|
+
path = resources.files(__package__).joinpath("ai/best_practices.md")
|
|
227
|
+
with path.open("r", encoding="utf-8") as f:
|
|
228
|
+
content = f.read()
|
|
229
|
+
except (FileNotFoundError, OSError):
|
|
230
|
+
content = _FALLBACK_BEST_PRACTICES
|
|
231
|
+
|
|
232
|
+
if file is not None:
|
|
233
|
+
# just print out the content, no need to return it
|
|
234
|
+
print(content, file=file)
|
|
235
|
+
return None
|
|
236
|
+
|
|
237
|
+
# no output file was specified, return the content as a string
|
|
238
|
+
return content
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
__all__ = [
|
|
242
|
+
"__version__",
|
|
243
|
+
"__version_time__",
|
|
244
|
+
"__author__",
|
|
245
|
+
"__compat__",
|
|
246
|
+
"__diag__",
|
|
247
|
+
"And",
|
|
248
|
+
"AtLineStart",
|
|
249
|
+
"AtStringStart",
|
|
250
|
+
"CaselessKeyword",
|
|
251
|
+
"CaselessLiteral",
|
|
252
|
+
"CharsNotIn",
|
|
253
|
+
"CloseMatch",
|
|
254
|
+
"Combine",
|
|
255
|
+
"DelimitedList",
|
|
256
|
+
"Dict",
|
|
257
|
+
"Each",
|
|
258
|
+
"Empty",
|
|
259
|
+
"FollowedBy",
|
|
260
|
+
"Forward",
|
|
261
|
+
"GoToColumn",
|
|
262
|
+
"Group",
|
|
263
|
+
"IndentedBlock",
|
|
264
|
+
"Keyword",
|
|
265
|
+
"LineEnd",
|
|
266
|
+
"LineStart",
|
|
267
|
+
"Literal",
|
|
268
|
+
"Located",
|
|
269
|
+
"PrecededBy",
|
|
270
|
+
"MatchFirst",
|
|
271
|
+
"NoMatch",
|
|
272
|
+
"NotAny",
|
|
273
|
+
"OneOrMore",
|
|
274
|
+
"OnlyOnce",
|
|
275
|
+
"OpAssoc",
|
|
276
|
+
"Opt",
|
|
277
|
+
"Optional",
|
|
278
|
+
"Or",
|
|
279
|
+
"ParseBaseException",
|
|
280
|
+
"ParseElementEnhance",
|
|
281
|
+
"ParseException",
|
|
282
|
+
"ParseExpression",
|
|
283
|
+
"ParseFatalException",
|
|
284
|
+
"ParseResults",
|
|
285
|
+
"ParseSyntaxException",
|
|
286
|
+
"ParserElement",
|
|
287
|
+
"PositionToken",
|
|
288
|
+
"PyparsingDeprecationWarning",
|
|
289
|
+
"PyparsingDiagnosticWarning",
|
|
290
|
+
"PyparsingWarning",
|
|
291
|
+
"QuotedString",
|
|
292
|
+
"RecursiveGrammarException",
|
|
293
|
+
"Regex",
|
|
294
|
+
"SkipTo",
|
|
295
|
+
"StringEnd",
|
|
296
|
+
"StringStart",
|
|
297
|
+
"Suppress",
|
|
298
|
+
"Tag",
|
|
299
|
+
"Token",
|
|
300
|
+
"TokenConverter",
|
|
301
|
+
"White",
|
|
302
|
+
"Word",
|
|
303
|
+
"WordEnd",
|
|
304
|
+
"WordStart",
|
|
305
|
+
"ZeroOrMore",
|
|
306
|
+
"Char",
|
|
307
|
+
"alphanums",
|
|
308
|
+
"alphas",
|
|
309
|
+
"alphas8bit",
|
|
310
|
+
"any_close_tag",
|
|
311
|
+
"any_open_tag",
|
|
312
|
+
"autoname_elements",
|
|
313
|
+
"c_style_comment",
|
|
314
|
+
"col",
|
|
315
|
+
"common_html_entity",
|
|
316
|
+
"condition_as_parse_action",
|
|
317
|
+
"counted_array",
|
|
318
|
+
"cpp_style_comment",
|
|
319
|
+
"dbl_quoted_string",
|
|
320
|
+
"dbl_slash_comment",
|
|
321
|
+
"delimited_list",
|
|
322
|
+
"dict_of",
|
|
323
|
+
"empty",
|
|
324
|
+
"hexnums",
|
|
325
|
+
"html_comment",
|
|
326
|
+
"identchars",
|
|
327
|
+
"identbodychars",
|
|
328
|
+
"infix_notation",
|
|
329
|
+
"java_style_comment",
|
|
330
|
+
"line",
|
|
331
|
+
"line_end",
|
|
332
|
+
"line_start",
|
|
333
|
+
"lineno",
|
|
334
|
+
"make_html_tags",
|
|
335
|
+
"make_xml_tags",
|
|
336
|
+
"match_only_at_col",
|
|
337
|
+
"match_previous_expr",
|
|
338
|
+
"match_previous_literal",
|
|
339
|
+
"nested_expr",
|
|
340
|
+
"null_debug_action",
|
|
341
|
+
"nums",
|
|
342
|
+
"one_of",
|
|
343
|
+
"original_text_for",
|
|
344
|
+
"printables",
|
|
345
|
+
"punc8bit",
|
|
346
|
+
"pyparsing_common",
|
|
347
|
+
"pyparsing_test",
|
|
348
|
+
"pyparsing_unicode",
|
|
349
|
+
"python_style_comment",
|
|
350
|
+
"quoted_string",
|
|
351
|
+
"remove_quotes",
|
|
352
|
+
"replace_with",
|
|
353
|
+
"replace_html_entity",
|
|
354
|
+
"rest_of_line",
|
|
355
|
+
"sgl_quoted_string",
|
|
356
|
+
"show_best_practices",
|
|
357
|
+
"srange",
|
|
358
|
+
"string_end",
|
|
359
|
+
"string_start",
|
|
360
|
+
"token_map",
|
|
361
|
+
"trace_parse_action",
|
|
362
|
+
"ungroup",
|
|
363
|
+
"unicode_set",
|
|
364
|
+
"unicode_string",
|
|
365
|
+
"with_attribute",
|
|
366
|
+
"with_class",
|
|
367
|
+
# pre-PEP8 compatibility names
|
|
368
|
+
"__versionTime__",
|
|
369
|
+
"anyCloseTag",
|
|
370
|
+
"anyOpenTag",
|
|
371
|
+
"cStyleComment",
|
|
372
|
+
"commonHTMLEntity",
|
|
373
|
+
"conditionAsParseAction",
|
|
374
|
+
"countedArray",
|
|
375
|
+
"cppStyleComment",
|
|
376
|
+
"dblQuotedString",
|
|
377
|
+
"dblSlashComment",
|
|
378
|
+
"delimitedList",
|
|
379
|
+
"dictOf",
|
|
380
|
+
"htmlComment",
|
|
381
|
+
"indentedBlock",
|
|
382
|
+
"infixNotation",
|
|
383
|
+
"javaStyleComment",
|
|
384
|
+
"lineEnd",
|
|
385
|
+
"lineStart",
|
|
386
|
+
"locatedExpr",
|
|
387
|
+
"makeHTMLTags",
|
|
388
|
+
"makeXMLTags",
|
|
389
|
+
"matchOnlyAtCol",
|
|
390
|
+
"matchPreviousExpr",
|
|
391
|
+
"matchPreviousLiteral",
|
|
392
|
+
"nestedExpr",
|
|
393
|
+
"nullDebugAction",
|
|
394
|
+
"oneOf",
|
|
395
|
+
"opAssoc",
|
|
396
|
+
"originalTextFor",
|
|
397
|
+
"pythonStyleComment",
|
|
398
|
+
"quotedString",
|
|
399
|
+
"removeQuotes",
|
|
400
|
+
"replaceHTMLEntity",
|
|
401
|
+
"replaceWith",
|
|
402
|
+
"restOfLine",
|
|
403
|
+
"sglQuotedString",
|
|
404
|
+
"stringEnd",
|
|
405
|
+
"stringStart",
|
|
406
|
+
"tokenMap",
|
|
407
|
+
"traceParseAction",
|
|
408
|
+
"unicodeString",
|
|
409
|
+
"withAttribute",
|
|
410
|
+
"withClass",
|
|
411
|
+
"common",
|
|
412
|
+
"unicode",
|
|
413
|
+
"testing",
|
|
414
|
+
]
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# Vendored by tools/vendor_deps.py from pyparsing 3.3.3 (see licenses/LICENSE_PYPARSING).
|
|
2
|
+
# actions.py
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Union, Callable, Any
|
|
6
|
+
|
|
7
|
+
from .exceptions import ParseException
|
|
8
|
+
from .util import col, replaced_by_pep8
|
|
9
|
+
from .results import ParseResults
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
ParseAction = Union[
|
|
13
|
+
Callable[[], Any],
|
|
14
|
+
Callable[[ParseResults], Any],
|
|
15
|
+
Callable[[int, ParseResults], Any],
|
|
16
|
+
Callable[[str, int, ParseResults], Any],
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class OnlyOnce:
|
|
21
|
+
"""
|
|
22
|
+
Wrapper for parse actions, to ensure they are only called once.
|
|
23
|
+
Note: parse action signature must include all 3 arguments.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
def __init__(self, method_call: Callable[[str, int, ParseResults], Any]) -> None:
|
|
27
|
+
from .core import _trim_arity
|
|
28
|
+
|
|
29
|
+
self.callable = _trim_arity(method_call)
|
|
30
|
+
self.called = False
|
|
31
|
+
|
|
32
|
+
def __call__(self, s: str, l: int, t: ParseResults) -> ParseResults:
|
|
33
|
+
if not self.called:
|
|
34
|
+
results = self.callable(s, l, t)
|
|
35
|
+
self.called = True
|
|
36
|
+
return results
|
|
37
|
+
raise ParseException(s, l, "OnlyOnce obj called multiple times w/out reset")
|
|
38
|
+
|
|
39
|
+
def reset(self):
|
|
40
|
+
"""
|
|
41
|
+
Allow the associated parse action to be called once more.
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
self.called = False
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def match_only_at_col(n: int) -> ParseAction:
|
|
48
|
+
"""
|
|
49
|
+
Helper method for defining parse actions that require matching at
|
|
50
|
+
a specific column in the input text.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
def verify_col(strg: str, locn: int, toks: ParseResults) -> None:
|
|
54
|
+
if col(locn, strg) != n:
|
|
55
|
+
raise ParseException(strg, locn, f"matched token not at column {n}")
|
|
56
|
+
|
|
57
|
+
return verify_col
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def replace_with(repl_str: Any) -> ParseAction:
|
|
61
|
+
"""
|
|
62
|
+
Helper method for common parse actions that simply return
|
|
63
|
+
a literal value. Especially useful when used with
|
|
64
|
+
:meth:`~ParserElement.transform_string`.
|
|
65
|
+
|
|
66
|
+
Example:
|
|
67
|
+
|
|
68
|
+
.. doctest::
|
|
69
|
+
|
|
70
|
+
>>> num = Word(nums).set_parse_action(lambda toks: int(toks[0]))
|
|
71
|
+
>>> na = one_of("N/A NA").set_parse_action(replace_with(math.nan))
|
|
72
|
+
>>> term = na | num
|
|
73
|
+
|
|
74
|
+
>>> term[1, ...].parse_string("324 234 N/A 234")
|
|
75
|
+
ParseResults([324, 234, nan, 234], {})
|
|
76
|
+
"""
|
|
77
|
+
return lambda s, l, t: [repl_str]
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def remove_quotes(s: str, l: int, t: ParseResults) -> Any:
|
|
81
|
+
r"""
|
|
82
|
+
Helper parse action for removing quotation marks from parsed
|
|
83
|
+
quoted strings, that use a single character for quoting. For parsing
|
|
84
|
+
strings that may have multiple characters, use the :class:`QuotedString`
|
|
85
|
+
class.
|
|
86
|
+
|
|
87
|
+
Example:
|
|
88
|
+
|
|
89
|
+
.. doctest::
|
|
90
|
+
|
|
91
|
+
>>> # by default, quotation marks are included in parsed results
|
|
92
|
+
>>> quoted_string.parse_string("'Now is the Winter of our Discontent'")
|
|
93
|
+
ParseResults(["'Now is the Winter of our Discontent'"], {})
|
|
94
|
+
|
|
95
|
+
>>> # use remove_quotes to strip quotation marks from parsed results
|
|
96
|
+
>>> dequoted = quoted_string().set_parse_action(remove_quotes)
|
|
97
|
+
>>> dequoted.parse_string("'Now is the Winter of our Discontent'")
|
|
98
|
+
ParseResults(['Now is the Winter of our Discontent'], {})
|
|
99
|
+
"""
|
|
100
|
+
return t[0][1:-1]
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def with_attribute(*args: tuple[str, str], **attr_dict) -> ParseAction:
|
|
104
|
+
"""
|
|
105
|
+
Helper to create a validating parse action to be used with start
|
|
106
|
+
tags created with :class:`make_xml_tags` or
|
|
107
|
+
:class:`make_html_tags`. Use ``with_attribute`` to qualify
|
|
108
|
+
a starting tag with a required attribute value, to avoid false
|
|
109
|
+
matches on common tags such as ``<TD>`` or ``<DIV>``.
|
|
110
|
+
|
|
111
|
+
Call ``with_attribute`` with a series of attribute names and
|
|
112
|
+
values. Specify the list of filter attributes names and values as:
|
|
113
|
+
|
|
114
|
+
- keyword arguments, as in ``(align="right")``, or
|
|
115
|
+
- as an explicit dict with ``**`` operator, when an attribute
|
|
116
|
+
name is also a Python reserved word, as in ``**{"class":"Customer", "align":"right"}``
|
|
117
|
+
- a list of name-value tuples, as in ``(("ns1:class", "Customer"), ("ns2:align", "right"))``
|
|
118
|
+
|
|
119
|
+
For attribute names with a namespace prefix, you must use the second
|
|
120
|
+
form. Attribute names are matched insensitive to upper/lower case.
|
|
121
|
+
|
|
122
|
+
If just testing for ``class`` (with or without a namespace), use
|
|
123
|
+
:class:`with_class`.
|
|
124
|
+
|
|
125
|
+
To verify that the attribute exists, but without specifying a value,
|
|
126
|
+
pass ``with_attribute.ANY_VALUE`` as the value.
|
|
127
|
+
|
|
128
|
+
The next two examples use the following input data and tag parsers:
|
|
129
|
+
|
|
130
|
+
.. testcode::
|
|
131
|
+
|
|
132
|
+
html = '''
|
|
133
|
+
<div>
|
|
134
|
+
Some text
|
|
135
|
+
<div type="grid">1 4 0 1 0</div>
|
|
136
|
+
<div type="graph">1,3 2,3 1,1</div>
|
|
137
|
+
<div>this has no type</div>
|
|
138
|
+
</div>
|
|
139
|
+
'''
|
|
140
|
+
div,div_end = make_html_tags("div")
|
|
141
|
+
|
|
142
|
+
Only match div tag having a type attribute with value "grid":
|
|
143
|
+
|
|
144
|
+
.. testcode::
|
|
145
|
+
|
|
146
|
+
div_grid = div().set_parse_action(with_attribute(type="grid"))
|
|
147
|
+
grid_expr = div_grid + SkipTo(div | div_end)("body")
|
|
148
|
+
for grid_header in grid_expr.search_string(html):
|
|
149
|
+
print(grid_header.body)
|
|
150
|
+
|
|
151
|
+
prints:
|
|
152
|
+
|
|
153
|
+
.. testoutput::
|
|
154
|
+
|
|
155
|
+
1 4 0 1 0
|
|
156
|
+
|
|
157
|
+
Construct a match with any div tag having a type attribute,
|
|
158
|
+
regardless of the value:
|
|
159
|
+
|
|
160
|
+
.. testcode::
|
|
161
|
+
|
|
162
|
+
div_any_type = div().set_parse_action(
|
|
163
|
+
with_attribute(type=with_attribute.ANY_VALUE)
|
|
164
|
+
)
|
|
165
|
+
div_expr = div_any_type + SkipTo(div | div_end)("body")
|
|
166
|
+
for div_header in div_expr.search_string(html):
|
|
167
|
+
print(div_header.body)
|
|
168
|
+
|
|
169
|
+
prints:
|
|
170
|
+
|
|
171
|
+
.. testoutput::
|
|
172
|
+
|
|
173
|
+
1 4 0 1 0
|
|
174
|
+
1,3 2,3 1,1
|
|
175
|
+
"""
|
|
176
|
+
attrs_list: list[tuple[str, str]] = []
|
|
177
|
+
if args:
|
|
178
|
+
attrs_list.extend(args)
|
|
179
|
+
else:
|
|
180
|
+
attrs_list.extend(attr_dict.items())
|
|
181
|
+
|
|
182
|
+
def pa(s: str, l: int, tokens: ParseResults) -> None:
|
|
183
|
+
for attrName, attrValue in attrs_list:
|
|
184
|
+
if attrName not in tokens:
|
|
185
|
+
raise ParseException(s, l, f"no matching attribute {attrName!r}")
|
|
186
|
+
if attrValue != with_attribute.ANY_VALUE and tokens[attrName] != attrValue: # type: ignore [attr-defined]
|
|
187
|
+
raise ParseException(
|
|
188
|
+
s,
|
|
189
|
+
l,
|
|
190
|
+
f"attribute {attrName!r} has value {tokens[attrName]!r}, must be {attrValue!r}",
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
return pa
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
with_attribute.ANY_VALUE = object() # type: ignore [attr-defined]
|
|
197
|
+
"Value to use with :class:`with_attribute` parse action, to match any value, as long as the attribute is present"
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def with_class(classname: str, namespace: str = "") -> ParseAction:
|
|
201
|
+
"""
|
|
202
|
+
Simplified version of :meth:`with_attribute` when
|
|
203
|
+
matching on a div class - made difficult because ``class`` is
|
|
204
|
+
a reserved word in Python.
|
|
205
|
+
|
|
206
|
+
Using similar input data to the :meth:`with_attribute` examples:
|
|
207
|
+
|
|
208
|
+
.. testcode::
|
|
209
|
+
|
|
210
|
+
html = '''
|
|
211
|
+
<div>
|
|
212
|
+
Some text
|
|
213
|
+
<div class="grid">1 4 0 1 0</div>
|
|
214
|
+
<div class="graph">1,3 2,3 1,1</div>
|
|
215
|
+
<div>this <div> has no class</div>
|
|
216
|
+
</div>
|
|
217
|
+
'''
|
|
218
|
+
div,div_end = make_html_tags("div")
|
|
219
|
+
|
|
220
|
+
Only match div tag having the "grid" class:
|
|
221
|
+
|
|
222
|
+
.. testcode::
|
|
223
|
+
|
|
224
|
+
div_grid = div().set_parse_action(with_class("grid"))
|
|
225
|
+
grid_expr = div_grid + SkipTo(div | div_end)("body")
|
|
226
|
+
for grid_header in grid_expr.search_string(html):
|
|
227
|
+
print(grid_header.body)
|
|
228
|
+
|
|
229
|
+
prints:
|
|
230
|
+
|
|
231
|
+
.. testoutput::
|
|
232
|
+
|
|
233
|
+
1 4 0 1 0
|
|
234
|
+
|
|
235
|
+
Construct a match with any div tag having a class attribute,
|
|
236
|
+
regardless of the value:
|
|
237
|
+
|
|
238
|
+
.. testcode::
|
|
239
|
+
|
|
240
|
+
div_any_type = div().set_parse_action(
|
|
241
|
+
with_class(withAttribute.ANY_VALUE)
|
|
242
|
+
)
|
|
243
|
+
div_expr = div_any_type + SkipTo(div | div_end)("body")
|
|
244
|
+
for div_header in div_expr.search_string(html):
|
|
245
|
+
print(div_header.body)
|
|
246
|
+
|
|
247
|
+
prints:
|
|
248
|
+
|
|
249
|
+
.. testoutput::
|
|
250
|
+
|
|
251
|
+
1 4 0 1 0
|
|
252
|
+
1,3 2,3 1,1
|
|
253
|
+
"""
|
|
254
|
+
classattr = f"{namespace}:class" if namespace else "class"
|
|
255
|
+
return with_attribute(**{classattr: classname})
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
# Compatibility synonyms
|
|
259
|
+
# fmt: off
|
|
260
|
+
replaceWith = replaced_by_pep8("replaceWith", replace_with)
|
|
261
|
+
removeQuotes = replaced_by_pep8("removeQuotes", remove_quotes)
|
|
262
|
+
withAttribute = replaced_by_pep8("withAttribute", with_attribute)
|
|
263
|
+
withClass = replaced_by_pep8("withClass", with_class)
|
|
264
|
+
matchOnlyAtCol = replaced_by_pep8("matchOnlyAtCol", match_only_at_col)
|
|
265
|
+
# fmt: on
|