@@ -1444,6 +1444,46 @@ def aliased_name(self, s):
1444
1444
aliases = '' .join (' or %s' % x for x in sorted (self .aliasd .get (s , [])))
1445
1445
return s + aliases
1446
1446
1447
+ _NOT_LINKABLE = {
1448
+ # A set of property setter methods that are not available in our
1449
+ # current docs. This is a workaround used to prevent trying to link
1450
+ # these setters which would lead to "target reference not found"
1451
+ # warnings during doc build.
1452
+ 'matplotlib.image._ImageBase.set_alpha' ,
1453
+ 'matplotlib.image._ImageBase.set_array' ,
1454
+ 'matplotlib.image._ImageBase.set_data' ,
1455
+ 'matplotlib.image._ImageBase.set_filternorm' ,
1456
+ 'matplotlib.image._ImageBase.set_filterrad' ,
1457
+ 'matplotlib.image._ImageBase.set_interpolation' ,
1458
+ 'matplotlib.image._ImageBase.set_resample' ,
1459
+ 'matplotlib.image._ImageBase.set_alpha' ,
1460
+ 'matplotlib.image._ImageBase.set_array' ,
1461
+ 'matplotlib.image._ImageBase.set_data' ,
1462
+ 'matplotlib.image._ImageBase.set_filternorm' ,
1463
+ 'matplotlib.image._ImageBase.set_filterrad' ,
1464
+ 'matplotlib.image._ImageBase.set_interpolation' ,
1465
+ 'matplotlib.image._ImageBase.set_resample' ,
1466
+ 'matplotlib.image._ImageBase.set_alpha' ,
1467
+ 'matplotlib.image._ImageBase.set_array' ,
1468
+ 'matplotlib.image._ImageBase.set_filternorm' ,
1469
+ 'matplotlib.image._ImageBase.set_filterrad' ,
1470
+ 'matplotlib.image._ImageBase.set_interpolation' ,
1471
+ 'matplotlib.image._ImageBase.set_resample' ,
1472
+ 'matplotlib.image._ImageBase.set_alpha' ,
1473
+ 'matplotlib.image._ImageBase.set_array' ,
1474
+ 'matplotlib.image._ImageBase.set_filternorm' ,
1475
+ 'matplotlib.image._ImageBase.set_filterrad' ,
1476
+ 'matplotlib.image._ImageBase.set_resample' ,
1477
+ 'matplotlib.image._ImageBase.set_alpha' ,
1478
+ 'matplotlib.image._ImageBase.set_array' ,
1479
+ 'matplotlib.image._ImageBase.set_filternorm' ,
1480
+ 'matplotlib.image._ImageBase.set_filterrad' ,
1481
+ 'matplotlib.image._ImageBase.set_interpolation' ,
1482
+ 'matplotlib.image._ImageBase.set_resample' ,
1483
+ 'matplotlib.text._AnnotationBase.set_annotation_clip' ,
1484
+ 'matplotlib.text._AnnotationBase.set_annotation_clip' ,
1485
+ }
1486
+
1447
1487
def aliased_name_rest (self , s , target ):
1448
1488
"""
1449
1489
Return 'PROPNAME or alias' if *s* has an alias, else return 'PROPNAME',
@@ -1453,6 +1493,10 @@ def aliased_name_rest(self, s, target):
1453
1493
alias, return 'markerfacecolor or mfc' and for the transform
1454
1494
property, which does not, return 'transform'.
1455
1495
"""
1496
+ # workaround to prevent "reference target not found"
1497
+ if target in self ._NOT_LINKABLE :
1498
+ return f'``{ s } ``'
1499
+
1456
1500
aliases = '' .join (' or %s' % x for x in sorted (self .aliasd .get (s , [])))
1457
1501
return ':meth:`%s <%s>`%s' % (s , target , aliases )
1458
1502
@@ -1506,6 +1550,8 @@ def pprint_setters_rest(self, prop=None, leadingspace=4):
1506
1550
break
1507
1551
else : # No docstring available.
1508
1552
method = getattr (self .o , f"set_{ prop } " )
1553
+ if method .__qualname__ .startswith ('_' ):
1554
+ print (method .__qualname__ )
1509
1555
prop_and_qualnames .append (
1510
1556
(prop , f"{ method .__module__ } .{ method .__qualname__ } " ))
1511
1557
@@ -1713,7 +1759,7 @@ def kwdoc(artist):
1713
1759
"""
1714
1760
ai = ArtistInspector (artist )
1715
1761
return ('\n ' .join (ai .pprint_setters_rest (leadingspace = 4 ))
1716
- if mpl .rcParams ['docstring.hardcopy' ] else
1762
+ if mpl .rcParams ['docstring.hardcopy' ] or True else
1717
1763
'Properties:\n ' + '\n ' .join (ai .pprint_setters (leadingspace = 4 )))
1718
1764
1719
1765
# We defer this to the end of them module, because it needs ArtistInspector
0 commit comments