matplotlib-rs 0.0.8__cp315-cp315-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.cp315-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,534 @@
|
|
|
1
|
+
# Vendored from matplotlib 3.11 (see licenses/LICENSE_MATPLOTLIB), adapted for matplotlib_rs.
|
|
2
|
+
"""
|
|
3
|
+
Helper functions for deprecating parts of the Matplotlib API.
|
|
4
|
+
|
|
5
|
+
This documentation is only relevant for Matplotlib developers, not for users.
|
|
6
|
+
|
|
7
|
+
.. warning::
|
|
8
|
+
|
|
9
|
+
This module is for internal use only. Do not use it in your own code.
|
|
10
|
+
We may change the API at any time with no warning.
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import contextlib
|
|
15
|
+
import functools
|
|
16
|
+
import inspect
|
|
17
|
+
import math
|
|
18
|
+
import warnings
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class MatplotlibDeprecationWarning(DeprecationWarning):
|
|
22
|
+
"""A class for issuing deprecation warnings for Matplotlib users."""
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _generate_deprecation_warning(
|
|
26
|
+
since, message='', name='', alternative='', pending=False, obj_type='',
|
|
27
|
+
addendum='', *, removal=''):
|
|
28
|
+
if pending:
|
|
29
|
+
if removal:
|
|
30
|
+
raise ValueError("A pending deprecation cannot have a scheduled removal")
|
|
31
|
+
elif removal == '':
|
|
32
|
+
macro, meso, *_ = since.split('.')
|
|
33
|
+
removal = f'{macro}.{int(meso) + 2}'
|
|
34
|
+
if not message:
|
|
35
|
+
message = (
|
|
36
|
+
("The %(name)s %(obj_type)s" if obj_type else "%(name)s") +
|
|
37
|
+
(" will be deprecated in a future version" if pending else
|
|
38
|
+
(" was deprecated in Matplotlib %(since)s" +
|
|
39
|
+
(" and will be removed in %(removal)s" if removal else ""))) +
|
|
40
|
+
"." +
|
|
41
|
+
(" Use %(alternative)s instead." if alternative else "") +
|
|
42
|
+
(" %(addendum)s" if addendum else ""))
|
|
43
|
+
warning_cls = PendingDeprecationWarning if pending else MatplotlibDeprecationWarning
|
|
44
|
+
return warning_cls(message % dict(
|
|
45
|
+
func=name, name=name, obj_type=obj_type, since=since, removal=removal,
|
|
46
|
+
alternative=alternative, addendum=addendum))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def warn_deprecated(
|
|
50
|
+
since, *, message='', name='', alternative='', pending=False,
|
|
51
|
+
obj_type='', addendum='', removal=''):
|
|
52
|
+
"""
|
|
53
|
+
Display a standardized deprecation.
|
|
54
|
+
|
|
55
|
+
Parameters
|
|
56
|
+
----------
|
|
57
|
+
since : str
|
|
58
|
+
The release at which this API became deprecated.
|
|
59
|
+
message : str, optional
|
|
60
|
+
Override the default deprecation message. The ``%(since)s``,
|
|
61
|
+
``%(name)s``, ``%(alternative)s``, ``%(obj_type)s``, ``%(addendum)s``,
|
|
62
|
+
and ``%(removal)s`` format specifiers will be replaced by the values
|
|
63
|
+
of the respective arguments passed to this function.
|
|
64
|
+
name : str, optional
|
|
65
|
+
The name of the deprecated object.
|
|
66
|
+
alternative : str, optional
|
|
67
|
+
An alternative API that the user may use in place of the deprecated
|
|
68
|
+
API. The deprecation warning will tell the user about this alternative
|
|
69
|
+
if provided.
|
|
70
|
+
pending : bool, optional
|
|
71
|
+
If True, uses a PendingDeprecationWarning instead of a
|
|
72
|
+
DeprecationWarning. Cannot be used together with *removal*.
|
|
73
|
+
obj_type : str, optional
|
|
74
|
+
The object type being deprecated.
|
|
75
|
+
addendum : str, optional
|
|
76
|
+
Additional text appended directly to the final message.
|
|
77
|
+
removal : str, optional
|
|
78
|
+
The expected removal version. With the default (an empty string), a
|
|
79
|
+
removal version is automatically computed from *since*. Set to other
|
|
80
|
+
Falsy values to not schedule a removal date. Cannot be used together
|
|
81
|
+
with *pending*.
|
|
82
|
+
|
|
83
|
+
Examples
|
|
84
|
+
--------
|
|
85
|
+
::
|
|
86
|
+
|
|
87
|
+
# To warn of the deprecation of "matplotlib.name_of_module"
|
|
88
|
+
warn_deprecated('1.4.0', name='matplotlib.name_of_module',
|
|
89
|
+
obj_type='module')
|
|
90
|
+
"""
|
|
91
|
+
warning = _generate_deprecation_warning(
|
|
92
|
+
since, message, name, alternative, pending, obj_type, addendum,
|
|
93
|
+
removal=removal)
|
|
94
|
+
from . import warn_external
|
|
95
|
+
warn_external(warning, category=MatplotlibDeprecationWarning)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def deprecated(since, *, message='', name='', alternative='', pending=False,
|
|
99
|
+
obj_type=None, addendum='', removal=''):
|
|
100
|
+
"""
|
|
101
|
+
Decorator to mark a function, a class, or a property as deprecated.
|
|
102
|
+
|
|
103
|
+
When deprecating a classmethod, a staticmethod, or a property, the
|
|
104
|
+
``@deprecated`` decorator should go *under* ``@classmethod`` and
|
|
105
|
+
``@staticmethod`` (i.e., `deprecated` should directly decorate the
|
|
106
|
+
underlying callable), but *over* ``@property``.
|
|
107
|
+
|
|
108
|
+
When deprecating a class ``C`` intended to be used as a base class in a
|
|
109
|
+
multiple inheritance hierarchy, ``C`` *must* define an ``__init__`` method
|
|
110
|
+
(if ``C`` instead inherited its ``__init__`` from its own base class, then
|
|
111
|
+
``@deprecated`` would mess up ``__init__`` inheritance when installing its
|
|
112
|
+
own (deprecation-emitting) ``C.__init__``).
|
|
113
|
+
|
|
114
|
+
Parameters are the same as for `warn_deprecated`, except that *obj_type*
|
|
115
|
+
defaults to 'class' if decorating a class, 'attribute' if decorating a
|
|
116
|
+
property, and 'function' otherwise.
|
|
117
|
+
|
|
118
|
+
Examples
|
|
119
|
+
--------
|
|
120
|
+
::
|
|
121
|
+
|
|
122
|
+
@deprecated('1.4.0')
|
|
123
|
+
def the_function_to_deprecate():
|
|
124
|
+
pass
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
def deprecate(obj, message=message, name=name, alternative=alternative,
|
|
128
|
+
pending=pending, obj_type=obj_type, addendum=addendum):
|
|
129
|
+
from matplotlib_rs._api import classproperty
|
|
130
|
+
|
|
131
|
+
if isinstance(obj, type):
|
|
132
|
+
if obj_type is None:
|
|
133
|
+
obj_type = "class"
|
|
134
|
+
func = obj.__init__
|
|
135
|
+
name = name or obj.__name__
|
|
136
|
+
old_doc = obj.__doc__
|
|
137
|
+
|
|
138
|
+
def finalize(wrapper, new_doc):
|
|
139
|
+
try:
|
|
140
|
+
obj.__doc__ = new_doc
|
|
141
|
+
except AttributeError: # Can't set on some extension objects.
|
|
142
|
+
pass
|
|
143
|
+
obj.__init__ = functools.wraps(obj.__init__)(wrapper)
|
|
144
|
+
return obj
|
|
145
|
+
|
|
146
|
+
elif isinstance(obj, (property, classproperty)):
|
|
147
|
+
if obj_type is None:
|
|
148
|
+
obj_type = "attribute"
|
|
149
|
+
func = None
|
|
150
|
+
name = name or obj.fget.__name__
|
|
151
|
+
old_doc = obj.__doc__
|
|
152
|
+
|
|
153
|
+
class _deprecated_property(type(obj)):
|
|
154
|
+
def __get__(self, instance, owner=None):
|
|
155
|
+
if instance is not None or owner is not None \
|
|
156
|
+
and isinstance(self, classproperty):
|
|
157
|
+
emit_warning()
|
|
158
|
+
return super().__get__(instance, owner)
|
|
159
|
+
|
|
160
|
+
def __set__(self, instance, value):
|
|
161
|
+
if instance is not None:
|
|
162
|
+
emit_warning()
|
|
163
|
+
return super().__set__(instance, value)
|
|
164
|
+
|
|
165
|
+
def __delete__(self, instance):
|
|
166
|
+
if instance is not None:
|
|
167
|
+
emit_warning()
|
|
168
|
+
return super().__delete__(instance)
|
|
169
|
+
|
|
170
|
+
def __set_name__(self, owner, set_name):
|
|
171
|
+
nonlocal name
|
|
172
|
+
if name == "<lambda>":
|
|
173
|
+
name = set_name
|
|
174
|
+
|
|
175
|
+
def finalize(_, new_doc):
|
|
176
|
+
return _deprecated_property(
|
|
177
|
+
fget=obj.fget, fset=obj.fset, fdel=obj.fdel, doc=new_doc)
|
|
178
|
+
|
|
179
|
+
else:
|
|
180
|
+
if obj_type is None:
|
|
181
|
+
obj_type = "function"
|
|
182
|
+
func = obj
|
|
183
|
+
name = name or obj.__name__
|
|
184
|
+
old_doc = func.__doc__
|
|
185
|
+
|
|
186
|
+
def finalize(wrapper, new_doc):
|
|
187
|
+
wrapper = functools.wraps(func)(wrapper)
|
|
188
|
+
wrapper.__doc__ = new_doc
|
|
189
|
+
return wrapper
|
|
190
|
+
|
|
191
|
+
def emit_warning():
|
|
192
|
+
warn_deprecated(
|
|
193
|
+
since, message=message, name=name, alternative=alternative,
|
|
194
|
+
pending=pending, obj_type=obj_type, addendum=addendum,
|
|
195
|
+
removal=removal)
|
|
196
|
+
|
|
197
|
+
def wrapper(*args, **kwargs):
|
|
198
|
+
__tracebackhide__ = True
|
|
199
|
+
emit_warning()
|
|
200
|
+
return func(*args, **kwargs)
|
|
201
|
+
|
|
202
|
+
old_doc = inspect.cleandoc(old_doc or '').strip('\n')
|
|
203
|
+
|
|
204
|
+
notes_header = '\nNotes\n-----'
|
|
205
|
+
second_arg = ' '.join([t.strip() for t in
|
|
206
|
+
(message, f"Use {alternative} instead."
|
|
207
|
+
if alternative else "", addendum) if t])
|
|
208
|
+
new_doc = (f"[*Deprecated*] {old_doc}\n"
|
|
209
|
+
f"{notes_header if notes_header not in old_doc else ''}\n"
|
|
210
|
+
f".. deprecated:: {since}\n"
|
|
211
|
+
f" {second_arg}")
|
|
212
|
+
|
|
213
|
+
if not old_doc:
|
|
214
|
+
# This is to prevent a spurious 'unexpected unindent' warning from
|
|
215
|
+
# docutils when the original docstring was blank.
|
|
216
|
+
new_doc += r'\ '
|
|
217
|
+
|
|
218
|
+
return finalize(wrapper, new_doc)
|
|
219
|
+
|
|
220
|
+
return deprecate
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
class deprecate_privatize_attribute:
|
|
224
|
+
"""
|
|
225
|
+
Helper to deprecate public access to an attribute (or method).
|
|
226
|
+
|
|
227
|
+
This helper should only be used at class scope, as follows::
|
|
228
|
+
|
|
229
|
+
class Foo:
|
|
230
|
+
attr = _deprecate_privatize_attribute(*args, **kwargs)
|
|
231
|
+
|
|
232
|
+
where *all* parameters are forwarded to `deprecated`. This form makes
|
|
233
|
+
``attr`` a property which forwards read and write access to ``self._attr``
|
|
234
|
+
(same name but with a leading underscore), with a deprecation warning.
|
|
235
|
+
Note that the attribute name is derived from *the name this helper is
|
|
236
|
+
assigned to*. This helper also works for deprecating methods.
|
|
237
|
+
"""
|
|
238
|
+
|
|
239
|
+
def __init__(self, *args, **kwargs):
|
|
240
|
+
self.deprecator = deprecated(*args, **kwargs)
|
|
241
|
+
|
|
242
|
+
def __set_name__(self, owner, name):
|
|
243
|
+
setattr(owner, name, self.deprecator(
|
|
244
|
+
property(lambda self: getattr(self, f"_{name}"),
|
|
245
|
+
lambda self, value: setattr(self, f"_{name}", value)),
|
|
246
|
+
name=name))
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
# Used by _copy_docstring_and_deprecators to redecorate pyplot wrappers and
|
|
250
|
+
# boilerplate.py to retrieve original signatures. It may seem natural to store
|
|
251
|
+
# this information as an attribute on the wrapper, but if the wrapper gets
|
|
252
|
+
# itself functools.wraps()ed, then such attributes are silently propagated to
|
|
253
|
+
# the outer wrapper, which is not desired.
|
|
254
|
+
DECORATORS = {}
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def rename_parameter(since, old, new, func=None):
|
|
258
|
+
"""
|
|
259
|
+
Decorator indicating that parameter *old* of *func* is renamed to *new*.
|
|
260
|
+
|
|
261
|
+
The actual implementation of *func* should use *new*, not *old*. If *old*
|
|
262
|
+
is passed to *func*, a DeprecationWarning is emitted, and its value is
|
|
263
|
+
used, even if *new* is also passed by keyword (this is to simplify pyplot
|
|
264
|
+
wrapper functions, which always pass *new* explicitly to the Axes method).
|
|
265
|
+
If *new* is also passed but positionally, a TypeError will be raised by the
|
|
266
|
+
underlying function during argument binding.
|
|
267
|
+
|
|
268
|
+
Examples
|
|
269
|
+
--------
|
|
270
|
+
::
|
|
271
|
+
|
|
272
|
+
@_api.rename_parameter("3.1", "bad_name", "good_name")
|
|
273
|
+
def func(good_name): ...
|
|
274
|
+
"""
|
|
275
|
+
|
|
276
|
+
decorator = functools.partial(rename_parameter, since, old, new)
|
|
277
|
+
|
|
278
|
+
if func is None:
|
|
279
|
+
return decorator
|
|
280
|
+
|
|
281
|
+
signature = inspect.signature(func)
|
|
282
|
+
assert old not in signature.parameters, (
|
|
283
|
+
f"Matplotlib internal error: {old!r} cannot be a parameter for "
|
|
284
|
+
f"{func.__name__}()")
|
|
285
|
+
assert new in signature.parameters, (
|
|
286
|
+
f"Matplotlib internal error: {new!r} must be a parameter for "
|
|
287
|
+
f"{func.__name__}()")
|
|
288
|
+
|
|
289
|
+
@functools.wraps(func)
|
|
290
|
+
def wrapper(*args, **kwargs):
|
|
291
|
+
__tracebackhide__ = True
|
|
292
|
+
|
|
293
|
+
if old in kwargs:
|
|
294
|
+
warn_deprecated(
|
|
295
|
+
since, message=f"The {old!r} parameter of {func.__name__}() "
|
|
296
|
+
f"has been renamed {new!r} since Matplotlib {since}; support "
|
|
297
|
+
f"for the old name will be dropped in %(removal)s.")
|
|
298
|
+
kwargs[new] = kwargs.pop(old)
|
|
299
|
+
return func(*args, **kwargs)
|
|
300
|
+
|
|
301
|
+
# wrapper() must keep the same documented signature as func(): if we
|
|
302
|
+
# instead made both *old* and *new* appear in wrapper()'s signature, they
|
|
303
|
+
# would both show up in the pyplot function for an Axes method as well and
|
|
304
|
+
# pyplot would explicitly pass both arguments to the Axes method.
|
|
305
|
+
|
|
306
|
+
DECORATORS[wrapper] = decorator
|
|
307
|
+
return wrapper
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
class _deprecated_parameter_class:
|
|
311
|
+
def __repr__(self):
|
|
312
|
+
return "<deprecated parameter>"
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
_deprecated_parameter = _deprecated_parameter_class()
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def delete_parameter(since, name, func=None, **kwargs):
|
|
319
|
+
"""
|
|
320
|
+
Decorator indicating that parameter *name* of *func* is being deprecated.
|
|
321
|
+
|
|
322
|
+
The actual implementation of *func* should keep the *name* parameter in its
|
|
323
|
+
signature, or accept a ``**kwargs`` argument (through which *name* would be
|
|
324
|
+
passed).
|
|
325
|
+
|
|
326
|
+
Parameters that come after the deprecated parameter effectively become
|
|
327
|
+
keyword-only (as they cannot be passed positionally without triggering the
|
|
328
|
+
DeprecationWarning on the deprecated parameter), and should be marked as
|
|
329
|
+
such after the deprecation period has passed and the deprecated parameter
|
|
330
|
+
is removed.
|
|
331
|
+
|
|
332
|
+
Parameters other than *since*, *name*, and *func* are keyword-only and
|
|
333
|
+
forwarded to `.warn_deprecated`.
|
|
334
|
+
|
|
335
|
+
Examples
|
|
336
|
+
--------
|
|
337
|
+
::
|
|
338
|
+
|
|
339
|
+
@_api.delete_parameter("3.1", "unused")
|
|
340
|
+
def func(used_arg, other_arg, unused, more_args): ...
|
|
341
|
+
"""
|
|
342
|
+
|
|
343
|
+
decorator = functools.partial(delete_parameter, since, name, **kwargs)
|
|
344
|
+
|
|
345
|
+
if func is None:
|
|
346
|
+
return decorator
|
|
347
|
+
|
|
348
|
+
signature = inspect.signature(func)
|
|
349
|
+
# Name of `**kwargs` parameter of the decorated function, typically
|
|
350
|
+
# "kwargs" if such a parameter exists, or None if the decorated function
|
|
351
|
+
# doesn't accept `**kwargs`.
|
|
352
|
+
kwargs_name = next((param.name for param in signature.parameters.values()
|
|
353
|
+
if param.kind == inspect.Parameter.VAR_KEYWORD), None)
|
|
354
|
+
if name in signature.parameters:
|
|
355
|
+
kind = signature.parameters[name].kind
|
|
356
|
+
is_varargs = kind is inspect.Parameter.VAR_POSITIONAL
|
|
357
|
+
is_varkwargs = kind is inspect.Parameter.VAR_KEYWORD
|
|
358
|
+
if not is_varargs and not is_varkwargs:
|
|
359
|
+
name_idx = (
|
|
360
|
+
# Deprecated parameter can't be passed positionally.
|
|
361
|
+
math.inf if kind is inspect.Parameter.KEYWORD_ONLY
|
|
362
|
+
# If call site has no more than this number of parameters, the
|
|
363
|
+
# deprecated parameter can't have been passed positionally.
|
|
364
|
+
else [*signature.parameters].index(name))
|
|
365
|
+
func.__signature__ = signature = signature.replace(parameters=[
|
|
366
|
+
param.replace(default=_deprecated_parameter)
|
|
367
|
+
if param.name == name else param
|
|
368
|
+
for param in signature.parameters.values()])
|
|
369
|
+
else:
|
|
370
|
+
name_idx = -1 # Deprecated parameter can always have been passed.
|
|
371
|
+
else:
|
|
372
|
+
is_varargs = is_varkwargs = False
|
|
373
|
+
# Deprecated parameter can't be passed positionally.
|
|
374
|
+
name_idx = math.inf
|
|
375
|
+
assert kwargs_name, (
|
|
376
|
+
f"Matplotlib internal error: {name!r} must be a parameter for "
|
|
377
|
+
f"{func.__name__}()")
|
|
378
|
+
|
|
379
|
+
addendum = kwargs.pop('addendum', None)
|
|
380
|
+
|
|
381
|
+
@functools.wraps(func)
|
|
382
|
+
def wrapper(*inner_args, **inner_kwargs):
|
|
383
|
+
__tracebackhide__ = True
|
|
384
|
+
|
|
385
|
+
if len(inner_args) <= name_idx and name not in inner_kwargs:
|
|
386
|
+
# Early return in the simple, non-deprecated case (much faster than
|
|
387
|
+
# calling bind()).
|
|
388
|
+
return func(*inner_args, **inner_kwargs)
|
|
389
|
+
arguments = signature.bind(*inner_args, **inner_kwargs).arguments
|
|
390
|
+
if is_varargs and arguments.get(name):
|
|
391
|
+
warn_deprecated(
|
|
392
|
+
since, message=f"Additional positional arguments to "
|
|
393
|
+
f"{func.__name__}() are deprecated since %(since)s and "
|
|
394
|
+
f"support for them will be removed in %(removal)s.")
|
|
395
|
+
elif is_varkwargs and arguments.get(name):
|
|
396
|
+
warn_deprecated(
|
|
397
|
+
since, message=f"Additional keyword arguments to "
|
|
398
|
+
f"{func.__name__}() are deprecated since %(since)s and "
|
|
399
|
+
f"support for them will be removed in %(removal)s.")
|
|
400
|
+
# We cannot just check `name not in arguments` because the pyplot
|
|
401
|
+
# wrappers always pass all arguments explicitly.
|
|
402
|
+
elif any(name in d and d[name] != _deprecated_parameter
|
|
403
|
+
for d in [arguments, arguments.get(kwargs_name, {})]):
|
|
404
|
+
deprecation_addendum = (
|
|
405
|
+
f"If any parameter follows {name!r}, they should be passed as "
|
|
406
|
+
f"keyword, not positionally.")
|
|
407
|
+
warn_deprecated(
|
|
408
|
+
since,
|
|
409
|
+
name=repr(name),
|
|
410
|
+
obj_type=f"parameter of {func.__name__}()",
|
|
411
|
+
addendum=(addendum + " " + deprecation_addendum) if addendum
|
|
412
|
+
else deprecation_addendum,
|
|
413
|
+
**kwargs)
|
|
414
|
+
return func(*inner_args, **inner_kwargs)
|
|
415
|
+
|
|
416
|
+
DECORATORS[wrapper] = decorator
|
|
417
|
+
return wrapper
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
def make_keyword_only(since, name, func=None):
|
|
421
|
+
"""
|
|
422
|
+
Decorator indicating that passing parameter *name* (or any of the following
|
|
423
|
+
ones) positionally to *func* is being deprecated.
|
|
424
|
+
|
|
425
|
+
When used on a method that has a pyplot wrapper, this should be the
|
|
426
|
+
outermost decorator, so that :file:`boilerplate.py` can access the original
|
|
427
|
+
signature.
|
|
428
|
+
|
|
429
|
+
Examples
|
|
430
|
+
--------
|
|
431
|
+
Assume we want to only allow *dataset* and *positions* as positional
|
|
432
|
+
parameters on the method ::
|
|
433
|
+
|
|
434
|
+
def violinplot(self, dataset, positions=None, vert=None, ...)
|
|
435
|
+
|
|
436
|
+
Introduce the deprecation by adding the decorator ::
|
|
437
|
+
|
|
438
|
+
@_api.make_keyword_only("3.10", "vert")
|
|
439
|
+
def violinplot(self, dataset, positions=None, vert=None, ...)
|
|
440
|
+
|
|
441
|
+
When the deprecation expires, switch to ::
|
|
442
|
+
|
|
443
|
+
def violinplot(self, dataset, positions=None, *, vert=None, ...)
|
|
444
|
+
|
|
445
|
+
"""
|
|
446
|
+
|
|
447
|
+
decorator = functools.partial(make_keyword_only, since, name)
|
|
448
|
+
|
|
449
|
+
if func is None:
|
|
450
|
+
return decorator
|
|
451
|
+
|
|
452
|
+
signature = inspect.signature(func)
|
|
453
|
+
POK = inspect.Parameter.POSITIONAL_OR_KEYWORD
|
|
454
|
+
KWO = inspect.Parameter.KEYWORD_ONLY
|
|
455
|
+
assert (name in signature.parameters
|
|
456
|
+
and signature.parameters[name].kind == POK), (
|
|
457
|
+
f"Matplotlib internal error: {name!r} must be a positional-or-keyword "
|
|
458
|
+
f"parameter for {func.__name__}(). If this error happens on a function with a "
|
|
459
|
+
f"pyplot wrapper, make sure make_keyword_only() is the outermost decorator.")
|
|
460
|
+
names = [*signature.parameters]
|
|
461
|
+
name_idx = names.index(name)
|
|
462
|
+
kwonly = [name for name in names[name_idx:]
|
|
463
|
+
if signature.parameters[name].kind == POK]
|
|
464
|
+
|
|
465
|
+
@functools.wraps(func)
|
|
466
|
+
def wrapper(*args, **kwargs):
|
|
467
|
+
__tracebackhide__ = True
|
|
468
|
+
|
|
469
|
+
# Don't use signature.bind here, as it would fail when stacked with
|
|
470
|
+
# rename_parameter and an "old" argument name is passed in
|
|
471
|
+
# (signature.bind would fail, but the actual call would succeed).
|
|
472
|
+
if len(args) > name_idx:
|
|
473
|
+
warn_deprecated(
|
|
474
|
+
since, message="Passing the %(name)s %(obj_type)s "
|
|
475
|
+
"positionally is deprecated since Matplotlib %(since)s; the "
|
|
476
|
+
"parameter will become keyword-only in %(removal)s.",
|
|
477
|
+
name=name, obj_type=f"parameter of {func.__name__}()")
|
|
478
|
+
return func(*args, **kwargs)
|
|
479
|
+
|
|
480
|
+
# Don't modify *func*'s signature, as boilerplate.py needs it.
|
|
481
|
+
wrapper.__signature__ = signature.replace(parameters=[
|
|
482
|
+
param.replace(kind=KWO) if param.name in kwonly else param
|
|
483
|
+
for param in signature.parameters.values()])
|
|
484
|
+
DECORATORS[wrapper] = decorator
|
|
485
|
+
return wrapper
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
def deprecate_method_override(method, obj, *, allow_empty=False, **kwargs):
|
|
489
|
+
"""
|
|
490
|
+
Return ``obj.method`` with a deprecation if it was overridden, else None.
|
|
491
|
+
|
|
492
|
+
Parameters
|
|
493
|
+
----------
|
|
494
|
+
method
|
|
495
|
+
An unbound method, i.e. an expression of the form
|
|
496
|
+
``Class.method_name``. Remember that within the body of a method, one
|
|
497
|
+
can always use ``__class__`` to refer to the class that is currently
|
|
498
|
+
being defined.
|
|
499
|
+
obj
|
|
500
|
+
Either an object of the class where *method* is defined, or a subclass
|
|
501
|
+
of that class.
|
|
502
|
+
allow_empty : bool, default: False
|
|
503
|
+
Whether to allow overrides by "empty" methods without emitting a
|
|
504
|
+
warning.
|
|
505
|
+
**kwargs
|
|
506
|
+
Additional parameters passed to `warn_deprecated` to generate the
|
|
507
|
+
deprecation warning; must at least include the "since" key.
|
|
508
|
+
"""
|
|
509
|
+
|
|
510
|
+
def empty(): pass
|
|
511
|
+
def empty_with_docstring(): """doc"""
|
|
512
|
+
|
|
513
|
+
name = method.__name__
|
|
514
|
+
bound_child = getattr(obj, name)
|
|
515
|
+
bound_base = (
|
|
516
|
+
method # If obj is a class, then we need to use unbound methods.
|
|
517
|
+
if isinstance(bound_child, type(empty)) and isinstance(obj, type)
|
|
518
|
+
else method.__get__(obj))
|
|
519
|
+
if (bound_child != bound_base
|
|
520
|
+
and (not allow_empty
|
|
521
|
+
or (getattr(getattr(bound_child, "__code__", None),
|
|
522
|
+
"co_code", None)
|
|
523
|
+
not in [empty.__code__.co_code,
|
|
524
|
+
empty_with_docstring.__code__.co_code]))):
|
|
525
|
+
warn_deprecated(**{"name": name, "obj_type": "method", **kwargs})
|
|
526
|
+
return bound_child
|
|
527
|
+
return None
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
@contextlib.contextmanager
|
|
531
|
+
def suppress_matplotlib_deprecation_warning():
|
|
532
|
+
with warnings.catch_warnings():
|
|
533
|
+
warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
|
|
534
|
+
yield
|