DOC: Fix docs formatting for sharedoc.

The first line of indentation was incorrect.
This commit is contained in:
Scott Sanderson
2016-08-22 12:58:55 -04:00
parent 2eff193759
commit d52ff04626
+18 -8
View File
@@ -11,17 +11,24 @@ PIPELINE_DOWNSAMPLING_FREQUENCY_DOC = dedent(
frequency : {'year_start', 'quarter_start', 'month_start', 'week_start'}
A string indicating desired sampling dates:
'year_start' -> first trading day of each year
'quarter_start' -> first trading day of January, April, July, October
'month_start' -> first trading day of each month
'week_start' -> first trading_day of each week
* 'year_start' -> first trading day of each year
* 'quarter_start' -> first trading day of January, April, July, October
* 'month_start' -> first trading day of each month
* 'week_start' -> first trading_day of each week
"""
)
def pad_lines(prefix, s):
"""Apply a prefix to each line in s."""
return '\n'.join(prefix + line for line in s.splitlines())
def _gen_for_pad_lines_after_first(prefix, s):
lines = iter(s.splitlines())
yield next(lines)
for line in lines:
yield prefix + line
def pad_lines_after_first(prefix, s):
"""Apply a prefix to each line in s after the first."""
return '\n'.join(_gen_for_pad_lines_after_first(prefix, s))
def format_docstring(owner_name, docstring, formatters):
@@ -66,7 +73,10 @@ def format_docstring(owner_name, docstring, formatters):
)
(leading_whitespace, _) = matches[0]
format_params[target] = pad_lines(leading_whitespace, doc_for_target)
format_params[target] = pad_lines_after_first(
leading_whitespace,
doc_for_target,
)
return docstring.format(**format_params)