Skip to content

Commit f5ca623

Browse files
committed
Fix broken wrapper documentation
1 parent 636d37e commit f5ca623

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

proplot/axes/plot.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4321,14 +4321,16 @@ def _apply_wrappers(method, *args):
43214321
# Apply wrapper
43224322
# NOTE: Must assign fucn and method as keywords to avoid overwriting
43234323
# by look scope and associated recursion errors.
4324-
func._docstring_orig = func.__doc__ or ''
4325-
func._methods_wrapped = []
43264324
method = functools.wraps(method)(
43274325
lambda self, *args, func=func, method=method, **kwargs:
43284326
func(self, *args, _method=method, **kwargs)
43294327
)
43304328

43314329
# List wrapped methods in the driver function docstring
4330+
if not hasattr(func, '_methods_wrapped'):
4331+
func._methods_wrapped = []
4332+
if not hasattr(func, '_docstring_orig'):
4333+
func._docstring_orig = func.__doc__ or ''
43324334
docstring = func._docstring_orig
43334335
if '{methods}' not in docstring:
43344336
continue
@@ -4338,8 +4340,8 @@ def _apply_wrappers(method, *args):
43384340
if link not in methods:
43394341
methods.append(link)
43404342
prefix = ', '.join(methods[:-1])
4341-
modifier = ',' if len(methods) > 2 else ' and ' if len(methods) > 1 else ''
4342-
suffix = methods[-1]
4343+
modifier = ', and ' if len(methods) > 2 else ' and ' if len(methods) > 1 else ''
4344+
suffix = methods[-1] + '`.'
43434345
func.__doc__ = docstring.format(methods=prefix + modifier + suffix)
43444346

43454347
# Remove documentation

0 commit comments

Comments
 (0)