Skip to content

Commit 4f70c14

Browse files
committed
Use decorators to manipulate docstrings; patch by Jason Coombs
Tracker 2835685, file DocstringOptimizedTypeErrorRev5.patch svn path=/trunk/matplotlib/; revision=7491
1 parent b5f348d commit 4f70c14

18 files changed

+297
-389
lines changed

boilerplate.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
_fmtplot = """\
2121
# This function was autogenerated by boilerplate.py. Do not edit as
2222
# changes will be lost
23+
@autogen_docstring(Axes.%(func)s)
2324
def %(func)s(%(argspec)s):
2425
%(ax)s = gca()
2526
# allow callers to override the hold state by passing hold=True|False
@@ -34,19 +35,16 @@ def %(func)s(%(argspec)s):
3435
%(ax)s.hold(%(washold)s)
3536
%(mappable)s
3637
return %(ret)s
37-
if Axes.%(func)s.__doc__ is not None:
38-
%(func)s.__doc__ = dedent(Axes.%(func)s.__doc__) + __docstring_addendum
3938
"""
4039

4140
_fmtmisc = """\
4241
# This function was autogenerated by boilerplate.py. Do not edit as
4342
# changes will be lost
43+
@docstring.copy_dedent(Axes.%(func)s)
4444
def %(func)s(%(argspec)s):
4545
%(ret)s = gca().%(func)s(%(call)s)
4646
draw_if_interactive()
4747
return %(ret)s
48-
if Axes.%(func)s.__doc__ is not None:
49-
%(func)s.__doc__ = dedent(Axes.%(func)s.__doc__)
5048
"""
5149

5250
# these methods are all simple wrappers of Axes methods by the same

lib/matplotlib/artist.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import re, warnings
33
import matplotlib
44
import matplotlib.cbook as cbook
5+
from matplotlib import docstring
56
from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath
67
from path import Path
78

@@ -1193,5 +1194,4 @@ def kwdoc(a):
11931194
else:
11941195
return '\n'.join(ArtistInspector(a).pprint_setters(leadingspace=2))
11951196

1196-
kwdocd = dict()
1197-
kwdocd['Artist'] = kwdoc(Artist)
1197+
docstring.interpd.update(Artist=kwdoc(Artist))

0 commit comments

Comments
 (0)