8000 Normalize docstring interpolation label for kwdoc() property lists · matplotlib/matplotlib@d60629a · GitHub
[go: up one dir, main page]

Skip to content

Commit d60629a

Browse files
committed
Normalize docstring interpolation label for kwdoc() property lists
1 parent a02ffbc commit d60629a

File tree

15 files changed

+72
-71
lines changed

15 files changed

+72
-71
lines changed

lib/matplotlib/artist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1701,4 +1701,4 @@ def kwdoc(artist):
17011701
'Properties:\n' + '\n'.join(ai.pprint_setters(leadingspace=4)))
17021702

17031703

1704-
docstring.interpd.update(Artist=kwdoc(Artist))
1704+
docstring.interpd.update(Artist_kwdoc=kwdoc(Artist))

lib/matplotlib/axes/_axes.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def indicate_inset(self, bounds, inset_ax=None, *, transform=None,
396396
**kwargs
397397
Other keyword arguments are passed on to the `.Rectangle` patch:
398398
399-
%(Rectangle)s
399+
%(Rectangle_kwdoc)s
400400
401401
Returns
402402
-------
@@ -685,7 +685,7 @@ def axhline(self, y=0, xmin=0, xmax=1, **kwargs):
685685
Valid keyword arguments are `.Line2D` properties, with the
686686
exception of 'transform':
687687
688-
%(_Line2D_docstr)s
688+
%(Line2D_kwdoc)s
689689
690690
See Also
691691
--------
@@ -752,7 +752,7 @@ def axvline(self, x=0, ymin=0, ymax=1, **kwargs):
752752
Valid keyword arguments are `.Line2D` properties, with the
753753
exception of 'transform':
754754
755-
%(_Line2D_docstr)s
755+
%(Line2D_kwdoc)s
756756
757757
See Also
758758
--------
@@ -836,7 +836,7 @@ def axline(self, xy1, xy2=None, *, slope=None, **kwargs):
836836
**kwargs
837837
Valid kwargs are `.Line2D` properties
838838
839-
%(_Line2D_docstr)s
839+
%(Line2D_kwdoc)s
840840
841841
See Also
842842
--------
@@ -904,7 +904,7 @@ def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
904904
----------------
905905
**kwargs : `~matplotlib.patches.Polygon` properties
906906
907-
%(Polygon)s
907+
%(Polygon_kwdoc)s
908908
909909
See Also
910910
--------
@@ -951,7 +951,7 @@ def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
951951
----------------
952952
**kwargs : `~matplotlib.patches.Polygon` properties
953953
954-
%(Polygon)s
954+
%(Polygon_kwdoc)s
955955
956956
See Also
957957
--------
@@ -1502,7 +1502,7 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
15021502
15031503
Here is a list of available `.Line2D` properties:
15041504
1505-
%(_Line2D_docstr)s
1505+
%(Line2D_kwdoc)s
15061506
15071507
See Also
15081508
--------
@@ -1643,7 +1643,7 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
16431643
**kwargs
16441644
Keyword arguments control the `.Line2D` properties:
16451645
1646-
%(_Line2D_docstr)s
1646+
%(Line2D_kwdoc)s
16471647
16481648
See Also
16491649
--------
@@ -2214,7 +2214,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
22142214
22152215
**kwargs : `.Rectangle` properties
22162216
2217-
%(Rectangle)s
2217+
%(Rectangle_kwdoc)s
22182218
22192219
See Also
22202220
--------
@@ -2483,7 +2483,7 @@ def barh(self, y, width, height=0.8, left=None, *, align="center",
24832483
24842484
**kwargs : `.Rectangle` properties
24852485
2486-
%(Rectangle)s
2486+
%(Rectangle_kwdoc)s
24872487
24882488
See Also
24892489
--------
@@ -2544,7 +2544,7 @@ def broken_barh(self, xranges, yrange, **kwargs):
25442544
25452545
Supported keywords:
25462546
2547-
%(BrokenBarHCollection)s
2547+
%(BrokenBarHCollection_kwdoc)s
25482548
"""
25492549
# process the unit information
25502550
if len(xranges):
@@ -3133,7 +3133,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
31333133
31343134
Valid kwargs for the marker properties are `.Line2D` properties:
31353135
3136-
%(_Line2D_docstr)s
3136+
%(Line2D_kwdoc)s
31373137
"""
31383138
kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
31393139
# anything that comes in as 'None', drop so the default thing
@@ -4556,7 +4556,7 @@ def reduce_C_function(C: array) -> float
45564556
**kwargs : `~matplotlib.collections.PolyCollection` properties
45574557
All other keyword arguments are passed on to `.PolyCollection`:
45584558
4559-
%(PolyCollection)s
4559+
%(PolyCollection_kwdoc)s
45604560
45614561
"""
45624562
self._process_unit_info([("x", x), ("y", y)], kwargs, convert=False)
@@ -5072,7 +5072,7 @@ def _fill_between_x_or_y(
50725072
All other keyword arguments are passed on to `.PolyCollection`.
50735073
They control the `.Polygon` properties:
50745074
5075-
%(PolyCollection)s
5075+
%(PolyCollection_kwdoc)s
50765076
50775077
See Also
50785078
--------
@@ -5677,7 +5677,7 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
56775677
Additionally, the following arguments are allowed. They are passed
56785678
along to the `~matplotlib.collections.PolyCollection` constructor:
56795679
5680-
%(PolyCollection)s
5680+
%(PolyCollection_kwdoc)s
56815681
56825682
See Also
56835683
--------
@@ -5922,7 +5922,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
59225922
Additionally, the following arguments are allowed. They are passed
59235923
along to the `~matplotlib.collections.QuadMesh` constructor:
59245924
5925-
%(QuadMesh)s
5925+
%(QuadMesh_kwdoc)s
59265926
59275927
See Also
59285928
--------
@@ -6963,7 +6963,7 @@ def psd(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
69636963
**kwargs
69646964
Keyword arguments control the `.Line2D` properties:
69656965
6966-
%(_Line2D_docstr)s
6966+
%(Line2D_kwdoc)s
69676967
69686968
See Also
69696969
--------
@@ -7076,7 +7076,7 @@ def csd(self, x, y, NFFT=None, Fs=None, Fc=None, detrend=None,
70767076
**kwargs
70777077
Keyword arguments control the `.Line2D` properties:
70787078
7079-
%(_Line2D_docstr)s
7079+
%(Line2D_kwdoc)s
70807080
70817081
See Also
70827082
--------
@@ -7166,7 +7166,7 @@ def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None,
71667166
**kwargs
71677167
Keyword arguments control the `.Line2D` properties:
71687168
7169-
%(_Line2D_docstr)s
7169+
%(Line2D_kwdoc)s
71707170
71717171
See Also
71727172
--------
@@ -7243,7 +7243,7 @@ def angle_spectrum(self, x, Fs=None, Fc=None, window=None,
72437243
**kwargs
72447244
Keyword arguments control the `.Line2D` properties:
72457245
7246-
%(_Line2D_docstr)s
7246+
%(Line2D_kwdoc)s
72477247
72487248
See Also
72497249
--------
@@ -7309,7 +7309,7 @@ def phase_spectrum(self, x, Fs=None, Fc=None, window=None,
73097309
**kwargs
73107310
Keyword arguments control the `.Line2D` properties:
73117311
7312-
%(_Line2D_docstr)s
7312+
%(Line2D_kwdoc)s
73137313
73147314
See Also
73157315
--------
@@ -7376,7 +7376,7 @@ def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
73767376
**kwargs
73777377
Keyword arguments control the `.Line2D` properties:
73787378
7379-
%(_Line2D_docstr)s
7379+
%(Line2D_kwdoc)s
73807380
73817381
References
73827382
----------
@@ -7626,7 +7626,7 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
76267626
For the marker style, you can pass any `.Line2D` property except
76277627
for *linestyle*:
76287628
7629-
%(_Line2D_docstr)s
7629+
%(Line2D_kwdoc)s
76307630
"""
76317631
if marker is None and markersize is None and hasattr(Z, 'tocoo'):
76327632
marker = 's'

lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def __init__(self, fig, rect,
503503
**kwargs
504504
Other optional keyword arguments:
505505
506-
%(Axes)s
506+
%(Axes_kwdoc)s
507507
508508
Returns
509509
-------
@@ -2955,7 +2955,7 @@ def grid(self, b=None, which='major', axis='both', **kwargs):
29552955
29562956
Valid keyword arguments are:
29572957
2958-
%(_Line2D_docstr)s
2958+
%(Line2D_kwdoc)s
29592959
29602960
Notes
29612961
-----

lib/matplotlib/axes/_subplots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class when called with an axes class. This is purely to allow pickling of
210210
return subplot_class.__new__(subplot_class)
211211

212212

213-
docstring.interpd.update(Axes=martist.kwdoc(Axes))
213+
docstring.interpd.update(Axes_kwdoc=martist.kwdoc(Axes))
214214
docstring.dedent_interpd(Axes.__init__)
215215

216-
docstring.interpd.update(Subplot=martist.kwdoc(Axes))
216+
docstring.interpd.update(Subplot_kwdoc=martist.kwdoc(Axes))

lib/matplotlib/collections.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,10 +2082,10 @@ def draw(self, renderer):
20822082
self.stale = False
20832083

20842084

2085-
patchstr = artist.kwdoc(Collection)
2085+
_artist_kwdoc = artist.kwdoc(Collection)
20862086
for k in ('QuadMesh', 'TriMesh', 'PolyCollection', 'BrokenBarHCollection',
20872087
'RegularPolyCollection', 'PathCollection',
20882088
'StarPolygonCollection', 'PatchCollection',
20892089
'CircleCollection', 'Collection',):
2090-
docstring.interpd.update({k: patchstr})
2091-
docstring.interpd.update(LineCollection=artist.kwdoc(LineCollection))
2090+
docstring.interpd.update({f'{k}_kwdoc': _artist_kwdoc})
2091+
docstring.interpd.update(LineCollection_kwdoc=artist.kwdoc(LineCollection))

lib/matplotlib/figure.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ def add_axes(self, *args, **kwargs):
636636
arguments if another projection is used, see the actual Axes
637637
class.
638638
639-
%(Axes)s
639+
%(Axes_kwdoc)s
640640
641641
Notes
642642
-----
@@ -797,7 +797,7 @@ def add_subplot(self, *args, **kwargs):
797797
the following table but there might also be other keyword
798798
arguments if another projection is used.
799799
800-
%(Axes)s
800+
%(Axes_kwdoc)s
801801
802802
Notes
803803
-----
@@ -1598,7 +1598,7 @@ def gca(self, **kwargs):
15981598
adheres to the given projection etc., and for Axes creation if
15991599
the active Axes does not exist:
16001600
1601-
%(Axes)s
1601+
%(Axes_kwdoc)s
16021602
16031603
"""
16041604
ckey, cax = self._axstack.current_key_axes()
@@ -3341,4 +3341,5 @@ def figaspect(arg):
33413341
newsize = np.clip(newsize, figsize_min, figsize_max)
33423342
return newsize
33433343

3344-
docstring.interpd.update(Figure=martist.kwdoc(Figure))
3344+
3345+
docstring.interpd.update(Figure_kwdoc=martist.kwdoc(Figure))

lib/matplotlib/lines.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def __init__(self, xdata, ydata,
300300
301301
Additional keyword arguments are `.Line2D` properties:
302302
303-
%(_Line2D_docstr)s
303+
%(Line2D_kwdoc)s
304304
305305
See :meth:`set_linestyle` for a description of the line styles,
306306
:meth:`set_marker` for a description of the markers, and
@@ -1549,7 +1549,7 @@ def onpick(self, event):
15491549
drawStyles = Line2D.drawStyles
15501550
fillStyles = MarkerStyle.fillstyles
15511551

1552-
docstring.interpd.update(_Line2D_docstr=artist.kwdoc(Line2D))
1552+
docstring.interpd.update(Line2D_kwdoc=artist.kwdoc(Line2D))
15531553

15541554
# You can not set the docstring of an instancemethod,
15551555
# but you can on the underlying function. Go figure.

0 commit comments

Comments
 (0)
0