Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 644872b

Browse files
committed
Add documentation for _api module
1 parent 5a45fc2 commit 644872b

File tree

7 files changed

+40
-22
lines changed

7 files changed

+40
-22
lines changed

doc/api/_api_api.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*******************
2+
``matplotlib._api``
3+
*******************
4+
5+
.. automodule:: matplotlib._api
6+
:members:
7+
:undoc-members:
8+
:show-inheritance:
9+
10+
.. automodule:: matplotlib._api.deprecation
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:

doc/api/cbook_api.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,3 @@
66
:members:
77
:undoc-members:
88
:show-inheritance:
9-
10-
.. automodule:: matplotlib.cbook.deprecation
11-
:members:
12-
:undoc-members:
13-
:show-inheritance:

doc/api/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ Matplotlib consists of the following submodules:
126126
type1font.rst
127127
units_api.rst
128128
widgets_api.rst
129+
_api_api.rst
129130

130131
Toolkits
131132
--------

doc/api/prev_api_changes/api_changes_3.0.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ The following classes, methods, functions, and attributes are deprecated:
405405
- ``textpath.TextToPath.tex_font_map``
406406
- ``matplotlib.cbook.deprecation.mplDeprecation`` will be removed
407407
in future versions. It is just an alias for
408-
:class:`matplotlib.cbook.deprecation.MatplotlibDeprecationWarning`. Please
408+
``matplotlib.cbook.deprecation.MatplotlibDeprecationWarning``. Please
409409
use ``matplotlib.cbook.MatplotlibDeprecationWarning`` directly if necessary.
410410
- The ``matplotlib.cbook.Bunch`` class has been deprecated. Instead, use
411411
`types.SimpleNamespace` from the standard library which provides the same

doc/api/prev_api_changes/api_changes_3.1.0.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -767,12 +767,12 @@ The following signature related behaviours are deprecated:
767767
keyword.
768768
- The *interp_at_native* parameter to `.BboxImage`, which has had no effect
769769
since Matplotlib 2.0, is deprecated.
770-
- All arguments to the `~.cbook.deprecation.deprecated` decorator and
771-
`~.cbook.deprecation.warn_deprecated` function, except the first one (the
772-
version where the deprecation occurred), are now keyword-only. The goal is
773-
to avoid accidentally setting the "message" argument when the "name" (or
774-
"alternative") argument was intended, as this has repeatedly occurred in the
775-
past.
770+
- All arguments to the ``matplotlib.cbook.deprecation.deprecated`` decorator
771+
and ``matplotlib.cbook.deprecation.warn_deprecated`` function, except the
772+
first one (the version where the deprecation occurred), are now keyword-only.
773+
The goal is to avoid accidentally setting the "message" argument when the
774+
"name" (or "alternative") argument was intended, as this has repeatedly
775+
occurred in the past.
776776
- The arguments of `matplotlib.testing.compare.calculate_rms` have been renamed
777777
from ``expectedImage, actualImage``, to ``expected_image, actual_image``.
778778
- Passing positional arguments to `.Axis.set_ticklabels` beyond *ticklabels*
@@ -1076,8 +1076,8 @@ Undeprecations
10761076
--------------
10771077
The following API elements have been un-deprecated:
10781078

1079-
- The *obj_type* keyword argument to the `~.cbook.deprecation.deprecated`
1080-
decorator.
1079+
- The *obj_type* keyword argument to the
1080+
``matplotlib.cbook.deprecation.deprecated`` decorator.
10811081
- *xmin*, *xmax* keyword arguments to `.Axes.set_xlim` and *ymin*, *ymax*
10821082
keyword arguments to `.Axes.set_ylim`
10831083

doc/devel/contributing.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ There are five levels at which you can emit messages.
511511

512512
- `logging.critical` and `logging.error` are really only there for errors that
513513
will end the use of the library but not kill the interpreter.
514-
- `logging.warning` and `.cbook._warn_external` are used to warn the user,
514+
- `logging.warning` and `._api.warn_external` are used to warn the user,
515515
see below.
516516
- `logging.info` is for information that the user may want to know if the
517517
program behaves oddly. They are not displayed by default. For instance, if
@@ -527,16 +527,16 @@ By default, `logging` displays all log messages at levels higher than
527527
``logging.WARNING`` to `sys.stderr`.
528528

529529
The `logging tutorial`_ suggests that the difference between `logging.warning`
530-
and `.cbook._warn_external` (which uses `warnings.warn`) is that
531-
`.cbook._warn_external` should be used for things the user must change to stop
530+
and `._api.warn_external` (which uses `warnings.warn`) is that
531+
`._api.warn_external` should be used for things the user must change to stop
532532
the warning (typically in the source), whereas `logging.warning` can be more
533-
persistent. Moreover, note that `.cbook._warn_external` will by default only
533+
persistent. Moreover, note that `._api.warn_external` will by default only
534534
emit a given warning *once* for each line of user code, whereas
535535
`logging.warning` will display the message every time it is called.
536536

537537
By default, `warnings.warn` displays the line of code that has the ``warn``
538538
call. This usually isn't more informative than the warning message itself.
539-
Therefore, Matplotlib uses `.cbook._warn_external` which uses `warnings.warn`,
539+
Therefore, Matplotlib uses `._api.warn_external` which uses `warnings.warn`,
540540
but goes up the stack and displays the first line of code outside of
541541
Matplotlib. For example, for the module::
542542

@@ -559,13 +559,13 @@ will display::
559559
UserWarning: Attempting to set identical bottom==top
560560
warnings.warn('Attempting to set identical bottom==top')
561561

562-
Modifying the module to use `.cbook._warn_external`::
562+
Modifying the module to use `._api.warn_external`::
563563

564-
from matplotlib import cbook
564+
from matplotlib import _api
565565

566566
def set_range(bottom, top):
567567
if bottom == top:
568-
cbook._warn_external('Attempting to set identical bottom==top')
568+
_api.warn_external('Attempting to set identical bottom==top')
569569

570570
and running the same script will display::
571571

lib/matplotlib/_api/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
"""
2+
Helper functions for managing the Matplotlib API.
3+
4+
.. warning:
5+
6+
This module and its submodules is for internal use only.
7+
8+
"""
9+
110
import itertools
211
import re
312
import sys

0 commit comments

Comments
 (0)