Skip to content

Commit

Permalink
Reorder docstring to match numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Nov 8, 2021
1 parent 99bfe12 commit 9bb2c32
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions xarray/util/generate_reductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,14 @@ def {method}(
New {obj} with ``{method}`` applied to its data and the
indicated dimension(s) removed"""

TEMPLATE_SEE_ALSO = '''
TEMPLATE_SEE_ALSO = """
See Also
--------
numpy.{method}
dask.array.{method}
{see_also_obj}.{method}
:ref:`{docref}`
User guide on {docref_description}.
"""'''
User guide on {docref_description}."""

TEMPLATE_NOTES = """
Notes
Expand Down Expand Up @@ -232,18 +231,20 @@ def generate_method(self, method):

yield TEMPLATE_RETURNS.format(**template_kwargs)

yield textwrap.indent(self.generate_example(method=method), "")

if method.numeric_only:
yield TEMPLATE_NOTES.format(notes=_NUMERIC_ONLY_NOTES)

yield TEMPLATE_SEE_ALSO.format(
**template_kwargs,
docref=self.docref,
docref_description=self.docref_description,
see_also_obj=self.see_also_obj,
)

if method.numeric_only:
yield TEMPLATE_NOTES.format(notes=_NUMERIC_ONLY_NOTES)

yield textwrap.indent(self.generate_example(method=method), "")

yield ' """'

yield self.generate_code(method)

def generate_example(self, method):
Expand Down

0 comments on commit 9bb2c32

Please sign in to comment.