Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit93a0058

Browse files
committed
changed paths in kwdocs
1 parentbfa8d61 commit93a0058

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

‎lib/matplotlib/artist.py

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ def mouseover(self, val):
10531053

10541054
classArtistInspector(object):
10551055
"""
1056-
A helper class to inspect an:class:`~matplotlib.artist.Artist` and return
1056+
A helper class to inspect an `~matplotlib.artist.Artist` and return
10571057
information about its settable properties and their current values.
10581058
"""
10591059

@@ -1164,9 +1164,23 @@ def _get_setters_and_targets(self):
11641164
ifnameincls.__dict__:
11651165
source_class=cls.__module__+"."+cls.__name__
11661166
break
1167+
source_class=self._replace_path(source_class)
11671168
setters.append((name[4:],source_class+"."+name))
11681169
returnsetters
11691170

1171+
def_replace_path(self,source_class):
1172+
"""
1173+
Changes the full path to the public API path that is used
1174+
in sphinx. This is needed for links to work.
1175+
"""
1176+
1177+
replace_dict= {'_base._AxesBase':'Axes',
1178+
'_axes.Axes':'Axes'}
1179+
1180+
forkey,valueinreplace_dict.items():
1181+
source_class=source_class.replace(key,value)
1182+
returnsource_class
1183+
11701184
defget_setters(self):
11711185
"""
11721186
Get the attribute strings with setters for object. e.g., for a line,
@@ -1461,12 +1475,31 @@ def setp(obj, *args, **kwargs):
14611475
returnlist(cbook.flatten(ret))
14621476

14631477

1464-
defkwdoc(a):
1478+
defkwdoc(artist):
1479+
"""
1480+
Inspect an `~matplotlib.artist.Artist` class and return
1481+
information about its settable properties and their current values.
1482+
1483+
It use the class `.ArtistInspector`.
1484+
1485+
Parameters
1486+
----------
1487+
artist : `~matplotlib.artist.Artist` or an iterable of `Artist`\s
1488+
1489+
Returns
1490+
-------
1491+
string
1492+
Returns a string with a list or rst table with the settable properties
1493+
of the *artist*. The formating depends on the value of
1494+
:rc:`docstring.hardcopy`. False result in a list that is intended for
1495+
easy reading as a docstring and True result in a rst table intended
1496+
for rendering the documentation with sphinx.
1497+
"""
14651498
hardcopy=matplotlib.rcParams['docstring.hardcopy']
14661499
ifhardcopy:
1467-
return'\n'.join(ArtistInspector(a).pprint_setters_rest(
1500+
return'\n'.join(ArtistInspector(artist).pprint_setters_rest(
14681501
leadingspace=4))
14691502
else:
1470-
return'\n'.join(ArtistInspector(a).pprint_setters(leadingspace=2))
1503+
return'\n'.join(ArtistInspector(artist).pprint_setters(leadingspace=2))
14711504

14721505
docstring.interpd.update(Artist=kwdoc(Artist))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp