Skip to content

Commit d1f45f1

Browse files
committed
Merged revisions 7338 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r7338 | jouni | 2009-08-03 22:41:32 +0300 (Mon, 03 Aug 2009) | 2 lines Fixed boilerplate.py so it doesn't break the ReST docs. ........ svn path=/trunk/matplotlib/; revision=7339
1 parent 1052aa4 commit d1f45f1

File tree

3 files changed

+107
-4350
lines changed

3 files changed

+107
-4350
lines changed

CHANGELOG

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2009-08-03 Fixed boilerplate.py so it doesn't break the ReST docs. - JKS
2+
13
======================================================================
24

35
2009-07-31 Tagging 0.99.0.rc1 at 7314 - MGD

boilerplate.py

+4-18
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
# This function was autogenerated by boilerplate.py. Do not edit as
2222
# changes will be lost
2323
def %(func)s(%(argspec)s):
24-
%(docstring)s
2524
%(ax)s = gca()
2625
# allow callers to override the hold state by passing hold=True|False
2726
%(washold)s = %(ax)s.ishold()
@@ -35,16 +34,19 @@ def %(func)s(%(argspec)s):
3534
%(ax)s.hold(%(washold)s)
3635
%(mappable)s
3736
return %(ret)s
37+
if Axes.%(func)s.__doc__ is not None:
38+
%(func)s.__doc__ = dedent(Axes.%(func)s.__doc__) + __docstring_addendum
3839
"""
3940

4041
_fmtmisc = """\
4142
# This function was autogenerated by boilerplate.py. Do not edit as
4243
# changes will be lost
4344
def %(func)s(%(argspec)s):
44-
%(docstring)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__)
4850
"""
4951

5052
# these methods are all simple wrappers of Axes methods by the same
@@ -138,19 +140,6 @@ def remove_final_whitespace(string):
138140
"""
139141
return '\n'.join(x.rstrip() for x in string.split('\n'))
140142

141-
def make_docstring(cmd, mention_hold):
142-
func = getattr(Axes, cmd)
143-
docstring = inspect.getdoc(func)
144-
if docstring is None:
145-
return ""
146-
escaped = re.sub(r'\\', r'\\\\', docstring)
147-
if mention_hold:
148-
escaped += '''
149-
150-
Additional kwargs: hold = [True|False] overrides default hold state
151-
'''
152-
return '"""'+escaped+'"""'
153-
154143
for fmt,cmdlist in (_fmtplot,_plotcommands),(_fmtmisc,_misccommands):
155144
for func in cmdlist:
156145
# For some commands, an additional line is needed to set the
@@ -160,9 +149,6 @@ def make_docstring(cmd, mention_hold):
160149
else:
161150
mappable = ''
162151

163-
# Format docstring
164-
docstring = make_docstring(func, fmt is _fmtplot)
165-
166152
# Get argspec of wrapped function
167153
args, varargs, varkw, defaults = inspect.getargspec(getattr(Axes, func))
168154
args.pop(0) # remove 'self' argument

0 commit comments

Comments
 (0)