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

Commitc6c6cf7

Browse files
committed
changed paths in kwdocs
1 parent0a7c0d2 commitc6c6cf7

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

‎lib/matplotlib/artist.py

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ def mouseover(self, val):
10351035

10361036
classArtistInspector(object):
10371037
"""
1038-
A helper class to inspect an:class:`~matplotlib.artist.Artist` and return
1038+
A helper class to inspect an `~matplotlib.artist.Artist` and return
10391039
information about its settable properties and their current values.
10401040
"""
10411041

@@ -1146,9 +1146,23 @@ def _get_setters_and_targets(self):
11461146
ifnameincls.__dict__:
11471147
source_class=cls.__module__+"."+cls.__name__
11481148
break
1149+
source_class=self._replace_path(source_class)
11491150
setters.append((name[4:],source_class+"."+name))
11501151
returnsetters
11511152

1153+
def_replace_path(self,source_class):
1154+
"""
1155+
Changes the full path to the public API path that is used
1156+
in sphinx. This is needed for links to work.
1157+
"""
1158+
1159+
replace_dict= {'_base._AxesBase':'Axes',
1160+
'_axes.Axes':'Axes'}
1161+
1162+
forkey,valueinreplace_dict.items():
1163+
source_class=source_class.replace(key,value)
1164+
returnsource_class
1165+
11521166
defget_setters(self):
11531167
"""
11541168
Get the attribute strings with setters for object. e.g., for a line,
@@ -1443,12 +1457,32 @@ def setp(obj, *args, **kwargs):
14431457
returnlist(cbook.flatten(ret))
14441458

14451459

1446-
defkwdoc(a):
1460+
defkwdoc(artist):
1461+
"""
1462+
Inspect an `~matplotlib.artist.Artist` class and return
1463+
information about its settable properties and their current values.
1464+
1465+
It use the class `.ArtistInspector`.
1466+
1467+
Parameters
1468+
----------
1469+
artist : `~matplotlib.artist.Artist` or an iterable of `Artist`\s
1470+
1471+
Returns
1472+
-------
1473+
string
1474+
Returns a string with a list or rst table with the settable properties
1475+
of the *artist*. The formating depends on the value of
1476+
:rc:`docstring.hardcopy`. False result in a list that is intended for
1477+
easy reading as a docstring and True result in a rst table intended
1478+
for rendering the documentation with sphinx.
1479+
"""
14471480
hardcopy=matplotlib.rcParams['docstring.hardcopy']
14481481
ifhardcopy:
1449-
return'\n'.join(ArtistInspector(a).pprint_setters_rest(
1482+
return'\n'.join(ArtistInspector(artist).pprint_setters_rest(
14501483
leadingspace=4))
14511484
else:
1452-
return'\n'.join(ArtistInspector(a).pprint_setters(leadingspace=2))
1485+
return'\n'.join(ArtistInspector(artist).pprint_setters(
1486+
leadingspace=2))
14531487

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp