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

Skip to content

Commit bd5d341

Browse files
committed
DOCS: fully qualify docstring _enum refs
Avoid using explicit references to private module in docs, instead let intersphinx handle it.
1 parent cb756d3 commit bd5d341

File tree

6 files changed

+31
-24
lines changed

6 files changed

+31
-24
lines changed

doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def _check_dependencies():
142142
'dateutil': ('https://dateutil.readthedocs.io/en/stable/', None),
143143
'ipykernel': ('https://ipykernel.readthedocs.io/en/latest/', None),
144144
'numpy': ('https://numpy.org/doc/stable/', None),
145+
'matplotlib': ('https://matplotlib.org/stable/', None),
145146
'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None),
146147
'pytest': ('https://pytest.org/en/stable/', None),
147148
'python': ('https://docs.python.org/3/', None),

lib/matplotlib/_enums.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,5 +204,9 @@ def demo():
204204
+ ", ".join([f"'{cs.name}'" for cs in CapStyle]) \
205205
+ "}"
206206

207-
docstring.interpd.update({'JoinStyle': JoinStyle.input_description,
208-
'CapStyle': CapStyle.input_description})
207+
docstring.interpd.update({
208+
'JoinStyleLink': '`~matplotlib._enums.JoinStyle`',
209+
'JoinStyle': JoinStyle.input_description,
210+
'CapStyleLink': '`~matplotlib._enums.CapStyle`',
211+
'CapStyle': CapStyle.input_description
212+
})

lib/matplotlib/backend_bases.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,9 @@ def get_antialiased(self):
805805
"""Return whether the object should try to do antialiased rendering."""
806806
return self._antialiased
807807

808+
@docstring.interpd
808809
def get_capstyle(self):
809-
"""Return the `.CapStyle`."""
810+
"""Return the %(CapStyleLink)s."""
810811
return self._capstyle.name
811812

812813
def get_clip_rectangle(self):
@@ -850,8 +851,9 @@ def get_forced_alpha(self):
850851
"""
851852
return self._forced_alpha
852853

854+
@docstring.interpd
853855
def get_joinstyle(self):
854-
"""Return the `.JoinStyle`."""
856+
"""Return the %(JoinStyleLink)s."""
855857
return self._joinstyle.name
856858

857859
def get_linewidth(self):
@@ -910,7 +912,7 @@ def set_capstyle(self, cs):
910912
911913
Parameters
912914
----------
913-
cs : `.CapStyle` or %(CapStyle)s
915+
cs : %(CapStyleLink)s or %(CapStyle)s
914916
"""
915917
self._capstyle = CapStyle(cs)
916918

@@ -976,7 +978,7 @@ def set_joinstyle(self, js):
976978
977979
Parameters
978980
----------
979-
js : `.JoinStyle` or %(JoinStyle)s
981+
js : %(JoinStyleLink)s or %(JoinStyle)s
980982
"""
981983
self._joinstyle = JoinStyle(js)
982984

lib/matplotlib/collections.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ def __init__(self,
114114
where *onoffseq* is an even length tuple of on and off ink lengths
115115
in points. For examples, see
116116
:doc:`/gallery/lines_bars_and_markers/linestyles`.
117-
capstyle : `.CapStyle`-like, default: :rc:`patch.capstyle`
117+
capstyle : %(CapStyleLink)s-like, default: :rc:`patch.capstyle`
118118
Style to use for capping lines for all paths in the collection.
119119
Allowed values are %(CapStyle)s.
120-
joinstyle : `.JoinStyle`-like, default: :rc:`patch.joinstyle`
120+
joinstyle : %(JoinStyleLink)s-like, default: :rc:`patch.joinstyle`
121121
Style to use for joining lines for all paths in the collection.
122122
Allowed values are %(JoinStyle)s.
123123
antialiaseds : bool or list of bool, default: :rc:`patch.antialiased`
@@ -664,11 +664,11 @@ def set_linestyle(self, ls):
664664
@docstring.interpd
665665
def set_capstyle(self, cs):
666666
"""
667-
Set the `.CapStyle` for the collection (for all its elements).
667+
Set the %(CapStyleLink)s for the collection (for all its elements).
668668
669669
Parameters
670670
----------
671-
cs : `.CapStyle` or %(CapStyle)s
671+
cs : %(CapStyleLink)s or %(CapStyle)s
672672
"""
673673
self._capstyle = CapStyle(cs)
674674

@@ -678,11 +678,11 @@ def get_capstyle(self):
678678
@docstring.interpd
679679
def set_joinstyle(self, js):
680680
"""
681-
Set the `.JoinStyle` for the collection (for all its elements).
681+
Set the %(JoinStyleLink)s for the collection (for all its elements).
682682
683683
Parameters
684684
----------
685-
js : `.JoinStyle` or %(JoinStyle)s
685+
js : %(JoinStyleLink)s or %(JoinStyle)s
686686
"""
687687
self._joinstyle = JoinStyle(js)
688688

lib/matplotlib/lines.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,7 @@ def set_dash_joinstyle(self, s):
12951295
12961296
Parameters
12971297
----------
1298-
s : `.JoinStyle` or %(JoinStyle)s
1298+
s : %(JoinStyleLink)s or %(JoinStyle)s
12991299
"""
13001300
js = JoinStyle(s)
13011301
if self._dashjoinstyle != js:
@@ -1309,7 +1309,7 @@ def set_solid_joinstyle(self, s):
13091309
13101310
Parameters
13111311
----------
1312-
s : `.JoinStyle` or %(JoinStyle)s
1312+
s : %(JoinStyleLink)s or %(JoinStyle)s
13131313
"""
13141314
js = JoinStyle(s)
13151315
if self._solidjoinstyle != js:
@@ -1318,15 +1318,15 @@ def set_solid_joinstyle(self, s):
13181318

13191319
def get_dash_joinstyle(self):
13201320
"""
1321-
Return the `.JoinStyle` for dashed lines.
1321+
Return the %(JoinStyleLink)s for dashed lines.
13221322
13231323
See also `~.Line2D.set_dash_joinstyle`.
13241324
"""
13251325
return self._dashjoinstyle.name
13261326

13271327
def get_solid_joinstyle(self):
13281328
"""
1329-
Return the `.JoinStyle` for solid lines.
1329+
Return the %(JoinStyleLink)s for solid lines.
13301330
13311331
See also `~.Line2D.set_solid_joinstyle`.
13321332
"""
@@ -1339,7 +1339,7 @@ def set_dash_capstyle(self, s):
13391339
13401340
Parameters
13411341
----------
1342-
s : `.CapStyle` or %(CapStyle)s
1342+
s : %(CapStyleLink)s or %(CapStyle)s
13431343
"""
13441344
cs = CapStyle(s)
13451345
if self._dashcapstyle != cs:
@@ -1353,7 +1353,7 @@ def set_solid_capstyle(self, s):
13531353
13541354
Parameters
13551355
----------
1356-
s : `.CapStyle` or %(CapStyle)s
1356+
s : %(CapStyleLink)s or %(CapStyle)s
13571357
"""
13581358
cs = CapStyle(s)
13591359
if self._solidcapstyle != cs:
@@ -1362,15 +1362,15 @@ def set_solid_capstyle(self, s):
13621362

13631363
def get_dash_capstyle(self):
13641364
"""
1365-
Return the `.CapStyle` for dashed lines.
1365+
Return the %(CapStyleLink)s for dashed lines.
13661366
13671367
See also `~.Line2D.set_dash_capstyle`.
13681368
"""
13691369
return self._dashcapstyle.name
13701370

13711371
def get_solid_capstyle(self):
13721372
"""
1373-
Return the `.CapStyle` for solid lines.
1373+
Return the %(CapStyleLink)s for solid lines.
13741374
13751375
See also `~.Line2D.set_solid_capstyle`.
13761376
"""

lib/matplotlib/patches.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,11 @@ def get_fill(self):
479479
@docstring.interpd
480480
def set_capstyle(self, s):
481481
"""
482-
Set the `.CapStyle`.
482+
Set the %(CapStyleLink)s.
483483
484484
Parameters
485485
----------
486-
s : `.CapStyle` or %(CapStyle)s
486+
s : %(CapStyleLink)s or %(CapStyle)s
487487
"""
488488
cs = CapStyle(s)
489489
self._capstyle = cs
@@ -496,11 +496,11 @@ def get_capstyle(self):
496496
@docstring.interpd
497497
def set_joinstyle(self, s):
498498
"""
499-
Set the `.JoinStyle`.
499+
Set the %(JoinStyleLink)s.
500500
501501
Parameters
502502
----------
503-
s : `.JoinStyle` or %(JoinStyle)s
503+
s : %(JoinStyleLink)s or %(JoinStyle)s
504504
"""
505505
js = JoinStyle(s)
506506
self._joinstyle = js

0 commit comments

Comments
 (0)