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

Skip to content

Commit 3fc8fbb

Browse files
committed
DOC: Fix references in cbook.
1 parent bb6f4a2 commit 3fc8fbb

File tree

4 files changed

+28
-49
lines changed

4 files changed

+28
-49
lines changed

doc/api/prev_api_changes/api_changes_3.1.0.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -767,11 +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.deprecated` decorator and `.cbook.warn_deprecated`
771-
function, except the first one (the version where the deprecation occurred),
772-
are now keyword-only. The goal is to avoid accidentally setting the "message"
773-
argument when the "name" (or "alternative") argument was intended, as this has
774-
repeatedly occurred in the past.
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.
775776
- The arguments of `matplotlib.testing.compare.calculate_rms` have been renamed
776777
from ``expectedImage, actualImage``, to ``expected_image, actual_image``.
777778
- Passing positional arguments to `.Axis.set_ticklabels` beyond *ticklabels*
@@ -1073,11 +1074,12 @@ This only served as a helper to the private `.Axis._update_ticks`
10731074

10741075
Undeprecations
10751076
--------------
1076-
The following API elements have bee un-deprecated:
1077+
The following API elements have been un-deprecated:
10771078

1078-
- The *obj_type* kwarg to the `.cbook.deprecated` decorator.
1079-
- *xmin*, *xmax* kwargs to `.Axes.set_xlim` and *ymin*, *ymax* kwargs
1080-
to `.Axes.set_ylim`
1079+
- The *obj_type* keyword argument to the `~.cbook.deprecation.deprecated`
1080+
decorator.
1081+
- *xmin*, *xmax* keyword arguments to `.Axes.set_xlim` and *ymin*, *ymax*
1082+
keyword arguments to `.Axes.set_ylim`
10811083

10821084

10831085
New features

doc/devel/contributing.rst

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ There are five levels at which you can emit messages.
514514

515515
- `logging.critical` and `logging.error` are really only there for errors that
516516
will end the use of the library but not kill the interpreter.
517-
- `logging.warning` and `cbook._warn_external` are used to warn the user,
517+
- `logging.warning` and `.cbook._warn_external` are used to warn the user,
518518
see below.
519519
- `logging.info` is for information that the user may want to know if the
520520
program behaves oddly. They are not displayed by default. For instance, if
@@ -529,18 +529,17 @@ There are five levels at which you can emit messages.
529529
By default, `logging` displays all log messages at levels higher than
530530
`logging.WARNING` to `sys.stderr`.
531531

532-
The `logging tutorial`_ suggests that the difference
533-
between `logging.warning` and `cbook._warn_external` (which uses
534-
`warnings.warn`) is that `cbook._warn_external` should be used for things the
535-
user must change to stop the warning (typically in the source), whereas
536-
`logging.warning` can be more persistent. Moreover, note that
537-
`cbook._warn_external` will by default only emit a given warning *once* for
538-
each line of user code, whereas `logging.warning` will display the message
539-
every time it is called.
532+
The `logging tutorial`_ suggests that the difference between `logging.warning`
533+
and `.cbook._warn_external` (which uses `warnings.warn`) is that
534+
`.cbook._warn_external` should be used for things the user must change to stop
535+
the warning (typically in the source), whereas `logging.warning` can be more
536+
persistent. Moreover, note that `.cbook._warn_external` will by default only
537+
emit a given warning *once* for each line of user code, whereas
538+
`logging.warning` will display the message every time it is called.
540539

541540
By default, `warnings.warn` displays the line of code that has the `warn` call.
542541
This usually isn't more informative than the warning message itself. Therefore,
543-
Matplotlib uses `cbook._warn_external` which uses `warnings.warn`, but goes
542+
Matplotlib uses `.cbook._warn_external` which uses `warnings.warn`, but goes
544543
up the stack and displays the first line of code outside of Matplotlib.
545544
For example, for the module::
546545

@@ -563,7 +562,7 @@ will display::
563562
UserWarning: Attempting to set identical bottom==top
564563
warnings.warn('Attempting to set identical bottom==top')
565564

566-
Modifying the module to use `cbook._warn_external`::
565+
Modifying the module to use `.cbook._warn_external`::
567566

568567
from matplotlib import cbook
569568

doc/missing-references.json

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -808,19 +808,6 @@
808808
"can_composite": [
809809
"lib/matplotlib/image.py:docstring of matplotlib.image.composite_images:9"
810810
],
811-
"cbook._warn_external": [
812-
"doc/devel/contributing.rst:493",
813-
"doc/devel/contributing.rst:508",
814-
"doc/devel/contributing.rst:517",
815-
"doc/devel/contributing.rst:542"
816-
],
817-
"cbook.deprecated": [
818-
"doc/api/prev_api_changes/api_changes_3.1.0.rst:1074",
819-
"doc/api/prev_api_changes/api_changes_3.1.0.rst:766"
820-
],
821-
"cbook.warn_deprecated": [
822-
"doc/api/prev_api_changes/api_changes_3.1.0.rst:766"
823-
],
824811
"cleanup": [
825812
"lib/matplotlib/animation.py:docstring of matplotlib.animation.HTMLWriter.setup:19"
826813
],
@@ -915,13 +902,6 @@
915902
"doc/devel/contributing.rst:468",
916903
"doc/devel/contributing.rst:505"
917904
],
918-
"ls_mapper": [
919-
"doc/api/prev_api_changes/api_changes_1.5.0.rst:11"
920-
],
921-
"ls_mapper_r": [
922-
"doc/api/prev_api_changes/api_changes_1.5.0.rst:11",
923-
"doc/api/prev_api_changes/api_changes_1.5.0.rst:8"
924-
],
925905
"mainloop": [
926906
"lib/matplotlib/backends/backend_nbagg.py:docstring of matplotlib.backends.backend_nbagg.show:4"
927907
],
@@ -1281,10 +1261,6 @@
12811261
"matplotlib.animation.TimedAnimation.to_jshtml": [
12821262
"doc/api/_as_gen/matplotlib.animation.TimedAnimation.rst:23:<autosummary>:1"
12831263
],
1284-
"matplotlib.cbook.ls_mapper": [
1285-
"doc/api/prev_api_changes/api_changes_1.5.0.rst:11",
1286-
"doc/api/prev_api_changes/api_changes_1.5.0.rst:8"
1287-
],
12881264
"matplotlib.colorbar.ColorbarBase.set_clim": [
12891265
"doc/api/prev_api_changes/api_changes_3.1.0.rst:290"
12901266
],

lib/matplotlib/cbook/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ def get_sample_data(fname, asfileobj=True, *, np_load=False):
483483

484484
def _get_data_path(*args):
485485
"""
486-
Return the `Path` to a resource file provided by Matplotlib.
486+
Return the `pathlib.Path` to a resource file provided by Matplotlib.
487487
488488
``*args`` specify a path relative to the base data path.
489489
"""
@@ -989,7 +989,7 @@ def _combine_masks(*args):
989989
Masks are obtained from all arguments of the correct length
990990
in categories 1, 2, and 4; a point is bad if masked in a masked
991991
array or if it is a nan or inf. No attempt is made to
992-
extract a mask from categories 2 and 4 if :meth:`np.isfinite`
992+
extract a mask from categories 2 and 4 if `numpy.isfinite`
993993
does not yield a Boolean array. Category 3 is included to
994994
support RGB or RGBA ndarrays, which are assumed to have only
995995
valid values and which are passed through unchanged.
@@ -1243,9 +1243,9 @@ def _compute_conf_interval(data, med, iqr, bootstrap):
12431243
return bxpstats
12441244

12451245

1246-
# The ls_mapper maps short codes for line style to their full name used by
1247-
# backends; the reverse mapper is for mapping full names to short ones.
1246+
#: Maps short codes for line style to their full name used by backends.
12481247
ls_mapper = {'-': 'solid', '--': 'dashed', '-.': 'dashdot', ':': 'dotted'}
1248+
#: Maps full names for line styles used by backends to their short codes.
12491249
ls_mapper_r = {v: k for k, v in ls_mapper.items()}
12501250

12511251

@@ -1349,7 +1349,7 @@ def _reshape_2D(X, name):
13491349
Use Fortran ordering to convert ndarrays and lists of iterables to lists of
13501350
1D arrays.
13511351
1352-
Lists of iterables are converted by applying `np.asanyarray` to each of
1352+
Lists of iterables are converted by applying `numpy.asanyarray` to each of
13531353
their elements. 1D ndarrays are returned in a singleton list containing
13541354
them. 2D ndarrays are converted to the list of their *columns*.
13551355
@@ -2104,6 +2104,8 @@ def _warn_external(message, category=None):
21042104
function back to `warnings.warn`, i.e. ``cbook._warn_external =
21052105
warnings.warn`` (or ``functools.partial(warnings.warn, stacklevel=2)``,
21062106
etc.).
2107+
2108+
:meta public:
21072109
"""
21082110
frame = sys._getframe()
21092111
for stacklevel in itertools.count(1): # lgtm[py/unused-loop-variable]

0 commit comments

Comments
 (0)