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

Skip to content

Commit 7d7e141

Browse files
committed
Workaround to prevent "reference target not found" errors in doc builds
This introduces a known blacklist of currently non-linkable items.
1 parent 51c38d4 commit 7d7e141

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

doc/api/axis_api.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ XAxis Specific
181181
XAxis.get_text_heights
182182
XAxis.get_ticks_position
183183
XAxis.set_ticks_position
184+
XAxis.set_label_position
184185
XAxis.tick_bottom
185186
XAxis.tick_top
186187

@@ -197,6 +198,7 @@ YAxis Specific
197198
YAxis.get_ticks_position
198199
YAxis.set_offset_position
199200
YAxis.set_ticks_position
201+
YAxis.set_label_position
200202
YAxis.tick_left
201203
YAxis.tick_right
202204

@@ -264,4 +266,5 @@ specify a matching series of labels. Calling ``set_ticks`` makes a
264266
Tick.set_label1
265267
Tick.set_label2
266268
Tick.set_pad
269+
Tick.set_url
267270
Tick.update_position

lib/matplotlib/artist.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,21 @@ def aliased_name(self, s):
14391439
aliases = ''.join(' or %s' % x for x in sorted(self.aliasd.get(s, [])))
14401440
return s + aliases
14411441

1442+
_NOT_LINKABLE = {
1443+
# A set of property setter methods that are not available in our
1444+
# current docs. This is a workaround used to prevent trying to link
1445+
# these setters which would lead to "target reference not found"
1446+
# warnings during doc build.
1447+
'matplotlib.image._ImageBase.set_alpha',
1448+
'matplotlib.image._ImageBase.set_array',
1449+
'matplotlib.image._ImageBase.set_data',
1450+
'matplotlib.image._ImageBase.set_filternorm',
1451+
'matplotlib.image._ImageBase.set_filterrad',
1452+
'matplotlib.image._ImageBase.set_interpolation',
1453+
'matplotlib.image._ImageBase.set_resample',
1454+
'matplotlib.text._AnnotationBase.set_annotation_clip',
1455+
}
1456+
14421457
def aliased_name_rest(self, s, target):
14431458
"""
14441459
Return 'PROPNAME or alias' if *s* has an alias, else return 'PROPNAME',
@@ -1448,6 +1463,10 @@ def aliased_name_rest(self, s, target):
14481463
alias, return 'markerfacecolor or mfc' and for the transform
14491464
property, which does not, return 'transform'.
14501465
"""
1466+
# workaround to prevent "reference target not found"
1467+
if target in self._NOT_LINKABLE:
1468+
return f'``{s}``'
1469+
14511470
aliases = ''.join(' or %s' % x for x in sorted(self.aliasd.get(s, [])))
14521471
return ':meth:`%s <%s>`%s' % (s, target, aliases)
14531472

@@ -1708,7 +1727,7 @@ def kwdoc(artist):
17081727
"""
17091728
ai = ArtistInspector(artist)
17101729
return ('\n'.join(ai.pprint_setters_rest(leadingspace=4))
1711-
if mpl.rcParams['docstring.hardcopy'] else
1730+
if mpl.rcParams['docstring.hardcopy'] or True else
17121731
'Properties:\n' + '\n'.join(ai.pprint_setters(leadingspace=4)))
17131732

17141733
# We defer this to the end of them module, because it needs ArtistInspector

0 commit comments

Comments
 (0)