From b6a6d7953707a7542a518c67dac33524fe950e7b Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 26 Jan 2020 12:43:06 +0100 Subject: [PATCH] Fix some more missing references. --- doc/api/cbook_api.rst | 5 + doc/api/colors_api.rst | 1 + .../prev_api_changes/api_changes_3.0.0.rst | 2 +- doc/devel/contributing.rst | 2 +- doc/missing-references.json | 113 +++++++----------- lib/matplotlib/axes/_base.py | 2 +- lib/matplotlib/cbook/deprecation.py | 23 ++-- lib/matplotlib/colors.py | 8 +- lib/matplotlib/dates.py | 2 +- 9 files changed, 68 insertions(+), 90 deletions(-) diff --git a/doc/api/cbook_api.rst b/doc/api/cbook_api.rst index 4c8ef9cc50fa..f434fb9c6a26 100644 --- a/doc/api/cbook_api.rst +++ b/doc/api/cbook_api.rst @@ -6,3 +6,8 @@ :members: :undoc-members: :show-inheritance: + +.. automodule:: matplotlib.cbook.deprecation + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/api/colors_api.rst b/doc/api/colors_api.rst index 9a8717541b99..d15d2191886a 100644 --- a/doc/api/colors_api.rst +++ b/doc/api/colors_api.rst @@ -51,5 +51,6 @@ Functions to_rgba to_rgba_array is_color_like + same_color makeMappingArray get_named_colors_mapping diff --git a/doc/api/prev_api_changes/api_changes_3.0.0.rst b/doc/api/prev_api_changes/api_changes_3.0.0.rst index 03c8088adf9d..52e9b9ccf7f1 100644 --- a/doc/api/prev_api_changes/api_changes_3.0.0.rst +++ b/doc/api/prev_api_changes/api_changes_3.0.0.rst @@ -407,7 +407,7 @@ The following classes, methods, functions, and attributes are deprecated: in future versions. It is just an alias for :class:`matplotlib.cbook.deprecation.MatplotlibDeprecationWarning`. Please use the - :class:`~matplotlib.cbook.MatplotlibDeprecationWarning` directly if + ``matplotlib.cbook.MatplotlibDeprecationWarning`` directly if neccessary. - The ``matplotlib.cbook.Bunch`` class has been deprecated. Instead, use `types.SimpleNamespace` from the standard library which provides the same diff --git a/doc/devel/contributing.rst b/doc/devel/contributing.rst index 73dbcbf5eb97..434260dfd8f2 100644 --- a/doc/devel/contributing.rst +++ b/doc/devel/contributing.rst @@ -304,7 +304,7 @@ prevent unexpected breaking of code that uses Matplotlib. possible, the deprecation must never make a given piece of code do something different than it was before; at least an exception should be raised. - If possible, usage of an deprecated API should emit a - `MatplotlibDeprecationWarning`. There are a number of helper tools for this: + `.MatplotlibDeprecationWarning`. There are a number of helper tools for this: - Use `.cbook.warn_deprecated()` for general deprecation warnings. - Use the decorator ``@cbook.deprecated`` to deprecate classes, functions, diff --git a/doc/missing-references.json b/doc/missing-references.json index e0fba0717ce4..ce538374afc3 100644 --- a/doc/missing-references.json +++ b/doc/missing-references.json @@ -285,12 +285,6 @@ "matplotlib.backends.backend_webagg_core.NavigationToolbar2WebAgg": [ "lib/matplotlib/backends/backend_nbagg.py:docstring of matplotlib.backends.backend_nbagg.NavigationIPy:1" ], - "matplotlib.cbook.MatplotlibDeprecationWarning": [ - "doc/api/prev_api_changes/api_changes_3.0.0.rst:406" - ], - "matplotlib.cbook.deprecation.MatplotlibDeprecationWarning": [ - "doc/api/prev_api_changes/api_changes_3.0.0.rst:406" - ], "matplotlib.cm.Wistia": [ "doc/users/prev_whats_new/whats_new_1.4.rst:21" ], @@ -626,7 +620,7 @@ "doc/api/prev_api_changes/api_changes_0.91.0.rst:34" ], "matplotlib.pylab": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:624", + "doc/api/prev_api_changes/api_changes_3.1.0.rst:616", "doc/users/history.rst:63" ], "matplotlib.tests.test_basic": [ @@ -666,12 +660,12 @@ "lib/matplotlib/axes/_base.py:docstring of matplotlib.axes.Axes.update_datalim_bounds:2" ], "Axes.fmt_xdata": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:405", - "doc/api/prev_api_changes/api_changes_3.1.0.rst:408" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:397", + "doc/api/prev_api_changes/api_changes_3.1.0.rst:400" ], "Axes.fmt_ydata": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:405", - "doc/api/prev_api_changes/api_changes_3.1.0.rst:408" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:397", + "doc/api/prev_api_changes/api_changes_3.1.0.rst:400" ], "Axes.transData": [ "doc/api/prev_api_changes/api_changes_3.2.0/behavior.rst:89", @@ -684,14 +678,14 @@ "lib/matplotlib/axes/_base.py:docstring of matplotlib.axes.Axes.add_child_axes:2" ], "Axis._update_ticks": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:1074" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:1066" ], "Axis.get_inverted": [ "doc/users/prev_whats_new/whats_new_3.1.0.rst:241", "doc/users/prev_whats_new/whats_new_3.1.0.rst:243" ], "Axis.remove_overlaping_locs": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:79" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:71" ], "Axis.set_inverted": [ "doc/users/prev_whats_new/whats_new_3.1.0.rst:241", @@ -732,8 +726,8 @@ "doc/devel/MEP/MEP23.rst:87" ], "Formatter.__call__": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:1123", - "doc/api/prev_api_changes/api_changes_3.1.0.rst:1129" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:1115", + "doc/api/prev_api_changes/api_changes_3.1.0.rst:1121" ], "GaussianKDE": [ "lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes.Axes.violinplot:46", @@ -752,17 +746,7 @@ "lib/matplotlib/testing/decorators.py:docstring of matplotlib.testing.decorators.image_comparison:2" ], "ImageComparisonTest": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:710" - ], - "Legend": [ - "doc/api/axes_api.rst:316::1", - "lib/matplotlib/axes/_base.py:docstring of matplotlib.axes.Axes.get_legend:2" - ], - "LinearSegmentedColormaps": [ - "lib/matplotlib/colors.py:docstring of matplotlib.colors.makeMappingArray:64" - ], - "MatplotlibDeprecationWarning": [ - "doc/devel/contributing.rst:306" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:702" ], "MicrosecondLocator.__call__": [ "doc/api/prev_api_changes/api_changes_1.5.0.rst:119" @@ -789,7 +773,7 @@ "doc/devel/MEP/MEP23.rst:93" ], "NavigationToolbar2QT.adj_window": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:969" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:961" ], "PolyCollection.get_offset": [ "lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes.Axes.hexbin:71", @@ -899,19 +883,19 @@ "doc/users/prev_whats_new/whats_new_3.0.rst:111" ], "axes3d.Axes3D.xaxis": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:941" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:933" ], "axes3d.Axes3D.yaxis": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:941" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:933" ], "axes3d.Axes3D.zaxis": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:941" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:933" ], "axes_grid1": [ "doc/index.rst:184" ], "axis.Axis.get_ticks_position": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:829" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:821" ], "axisartist": [ "doc/index.rst:184" @@ -920,44 +904,44 @@ "lib/matplotlib/backends/backend_template.py:docstring of matplotlib.backends.backend_template.RendererTemplate:4" ], "backend_bases.Timer.add_callback": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:267" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:259" ], "backend_bases.Timer.remove_callback": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:247" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:239" ], "backend_bases.ToolContainerBase": [ "lib/matplotlib/backend_tools.py:docstring of matplotlib.backend_tools.add_tools_to_container:8" ], "backend_gtk3.FileChooserDialog": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:966" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:958" ], "backend_gtk3.NavigationToolbar2GTK3.get_filechooser": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:967" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:959" ], "backend_gtk3.SaveFigureGTK3.get_filechooser": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:968" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:960" ], "backend_wx.IDLE_DELAY": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:970" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:962" ], "barstacked": [ "doc/users/prev_whats_new/whats_new_1.2.rst:177" ], "bezier.check_if_parallel": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:801" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:793" ], "bezier.find_bezier_t_intersecting_with_closedpath": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:801" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:793" ], "bezier.find_r_to_boundary_of_closedpath": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:1026", - "doc/api/prev_api_changes/api_changes_3.1.0.rst:801" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:1018", + "doc/api/prev_api_changes/api_changes_3.1.0.rst:793" ], "bezier.split_bezier_intersecting_with_closedpath": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:801" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:793" ], "bezier.split_path_inout": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:801" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:793" ], "blocking_input.BlockingInput.__call__": [ "doc/api/prev_api_changes/api_changes_3.2.0/behavior.rst:293" @@ -979,17 +963,17 @@ "doc/devel/contributing.rst:521" ], "cbook.deprecated": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:1081", - "doc/api/prev_api_changes/api_changes_3.1.0.rst:774" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:1073", + "doc/api/prev_api_changes/api_changes_3.1.0.rst:766" ], "cbook.warn_deprecated": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:774" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:766" ], "cbook.warn_deprecated()": [ "doc/devel/contributing.rst:309" ], "collections.LineCollection.get_segements()": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:288" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:280" ], "colorbar.ColorbarBase.outline": [ "doc/api/prev_api_changes/api_changes_1.4.x.rst:83" @@ -998,13 +982,10 @@ "lib/matplotlib/testing/compare.py:docstring of matplotlib.testing.compare.compare_images:4" ], "dates.bytespdate2num": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:927" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:919" ], "dates.strpdate2num": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:926" - ], - "extend": [ - "lib/matplotlib/colors.py:docstring of matplotlib.colors.from_levels_and_colors:13" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:918" ], "fc-list": [ "lib/matplotlib/font_manager.py:docstring of matplotlib.font_manager.get_fontconfig_fonts:2" @@ -1101,7 +1082,7 @@ "doc/users/prev_whats_new/whats_new_2.0.0.rst:123" ], "legend.Legend.set_draggable()": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:507" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:499" ], "levels": [ "doc/api/prev_api_changes/api_changes_3.0.0.rst:197" @@ -1446,16 +1427,13 @@ "doc/api/prev_api_changes/api_changes_1.5.0.rst:8" ], "matplotlib.colorbar.ColorbarBase.set_clim": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:298" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:290" ], "matplotlib.colorbar.ColorbarBase.set_cmap": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:298" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:290" ], "matplotlib.colorbar.ColorbarBase.set_norm": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:298" - ], - "matplotlib.colors.same_color": [ - "doc/users/prev_whats_new/whats_new_2.2.rst:218" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:290" ], "matplotlib.contour.TriContourSet": [ "lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.tricontour:57", @@ -1473,10 +1451,10 @@ "doc/devel/documenting_mpl.rst:671" ], "matplotlib.pylab": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:626" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:618" ], "matplotlib.pyplot.get_scale_docs()": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:861" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:853" ], "matplotlib.sphinxext.mathmpl": [ "doc/users/prev_whats_new/whats_new_3.0.rst:225" @@ -1492,10 +1470,10 @@ "lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.rcdefaults:4" ], "matplotlib.testing.compare.calculate_rms": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:779" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:771" ], "matplotlib.testing.conftest.mpl_test_settings": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:949" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:941" ], "move_canvas": [ "doc/devel/MEP/MEP23.rst:65" @@ -1577,8 +1555,8 @@ "lib/matplotlib/dates.py:docstring of matplotlib.dates:105" ], "scipy.stats.norm.pdf": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:573", - "doc/api/prev_api_changes/api_changes_3.1.0.rst:659" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:565", + "doc/api/prev_api_changes/api_changes_3.1.0.rst:651" ], "self.codes": [ "lib/matplotlib/path.py:docstring of matplotlib.path.Path.codes:2" @@ -1631,10 +1609,7 @@ "doc/devel/MEP/MEP10.rst:170" ], "streamplot.Grid": [ - "doc/api/prev_api_changes/api_changes_3.1.0.rst:487" - ], - "strftime": [ - "lib/matplotlib/dates.py:docstring of matplotlib.dates.ConciseDateFormatter:18" + "doc/api/prev_api_changes/api_changes_3.1.0.rst:479" ], "style.available": [ "lib/matplotlib/style/__init__.py:docstring of matplotlib.style.context:12", diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 566b96782f36..c5aa98e5a3e6 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -1756,7 +1756,7 @@ def axis(self, *args, emit=True, **kwargs): return (*self.get_xlim(), *self.get_ylim()) def get_legend(self): - """Return the `Legend` instance, or None if no legend is defined.""" + """Return the `.Legend` instance, or None if no legend is defined.""" return self.legend_ def get_images(self): diff --git a/lib/matplotlib/cbook/deprecation.py b/lib/matplotlib/cbook/deprecation.py index 08e9480ae5d9..0ada728d59c0 100644 --- a/lib/matplotlib/cbook/deprecation.py +++ b/lib/matplotlib/cbook/deprecation.py @@ -17,8 +17,8 @@ class MatplotlibDeprecationWarning(UserWarning): """ +# mplDeprecation is deprecated. Use MatplotlibDeprecationWarning instead. mplDeprecation = MatplotlibDeprecationWarning -"""mplDeprecation is deprecated. Use MatplotlibDeprecationWarning instead.""" def _generate_deprecation_warning( @@ -57,7 +57,7 @@ def warn_deprecated( since, *, message='', name='', alternative='', pending=False, obj_type='', addendum='', removal=''): """ - Used to display deprecation in a standard way. + Display a standardized deprecation. Parameters ---------- @@ -65,12 +65,10 @@ def warn_deprecated( The release at which this API became deprecated. message : str, optional - Override the default deprecation message. The format - specifier `%(name)s` may be used for the name of the function, - and `%(alternative)s` may be used in the deprecation message - to insert the name of an alternative to the deprecated - function. `%(obj_type)s` may be used to insert a friendly name - for the type of object being deprecated. + Override the default deprecation message. The ``%(since)s``, + ``%(name)s``, ``%(alternative)s``, ``%(obj_type)s``, ``%(addendum)s``, + and ``%(removal)s`` format specifiers will be replaced by the values + of the respective arguments passed to this function. name : str, optional The name of the deprecated object. @@ -127,11 +125,10 @@ def deprecated(since, *, message='', name='', alternative='', pending=False, The release at which this API became deprecated. message : str, optional - Override the default deprecation message. The format - specifier `%(name)s` may be used for the name of the object, - and `%(alternative)s` may be used in the deprecation message - to insert the name of an alternative to the deprecated - object. + Override the default deprecation message. The ``%(since)s``, + ``%(name)s``, ``%(alternative)s``, ``%(obj_type)s``, ``%(addendum)s``, + and ``%(removal)s`` format specifiers will be replaced by the values + of the respective arguments passed to this function. name : str, optional The name used in the deprecation message; if not provided, the name diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 738919bf6790..9f58a03a9f90 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -441,7 +441,7 @@ def _create_lookup_table(N, data, gamma=1.0): Notes ----- - This function is internally used for `.LinearSegmentedColormaps`. + This function is internally used for `.LinearSegmentedColormap`. """ if callable(data): @@ -2024,9 +2024,9 @@ def from_levels_and_colors(levels, colors, extend='neither'): The quantization levels used to construct the :class:`BoundaryNorm`. Value ``v`` is quantized to level ``i`` if ``lev[i] <= v < lev[i+1]``. colors : sequence of colors - The fill color to use for each level. If `extend` is "neither" there - must be ``n_level - 1`` colors. For an `extend` of "min" or "max" add - one extra color, and for an `extend` of "both" add two colors. + The fill color to use for each level. If *extend* is "neither" there + must be ``n_level - 1`` colors. For an *extend* of "min" or "max" add + one extra color, and for an *extend* of "both" add two colors. extend : {'neither', 'min', 'max', 'both'}, optional The behaviour when a value falls out of range of the given levels. See :func:`~matplotlib.pyplot.contourf` for details. diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index c2e4a68edd3c..a924904c15bc 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -647,7 +647,7 @@ class ConciseDateFormatter(ticker.Formatter): formats : list of 6 strings, optional Format strings for 6 levels of tick labelling: mostly years, months, days, hours, minutes, and seconds. Strings use - the same format codes as `strftime`. Default is + the same format codes as `~datetime.datetime.strftime`. Default is ``['%Y', '%b', '%d', '%H:%M', '%H:%M', '%S.%f']`` zero_formats : list of 6 strings, optional