jenkins-bot has submitted this change and it was merged.
Change subject: [IMPROV] docs: rewrite docstring fixups
......................................................................
[IMPROV] docs: rewrite docstring fixups
Instead of using one long list comprehension it's now modifying the list
in-place and using a normal for-loop and an if-elif block.
Change-Id: I9d5c09c6ac9b3c06b320d607165aac6bc20ff21c
---
M docs/conf.py
1 file changed, 19 insertions(+), 14 deletions(-)
Approvals:
XZise: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py
index 2e59f19..223e4ad 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -252,20 +252,25 @@
def pywikibot_script_docstring_fixups(
app, what, name, obj, options, lines):
"""Pywikibot specific conversions."""
- result = ['This script supports use of :py:mod:`pywikibot.pagegenerators`
arguments.'
- if l in ('¶ms;', '&pagegenerators_help;')
- else ' The available fixes are listed in
:py:mod:`pywikibot.fixes`.'
- if l == '&fixes-help;'
- else l + ':'
- if l.endswith(':') and not l.strip().startswith(':') and
'Traceback (most recent call last)' not in l
- else ' ' + l if l.startswith('-')
- else l.replace(' ', ' ')
- if l.startswith(' ')
- else ' ' + l.strip()
- if l.strip().startswith('python')
- else l
- for l in lines]
- lines[:] = result[:]
+ for index, line in enumerate(lines):
+ if line in ('¶ms;', '&pagegenerators_help;'):
+ lines[index] = ('This script supports use of '
+ ':py:mod:`pywikibot.pagegenerators` arguments.')
+ elif line == '&fixes-help;':
+ lines[index] = (' The available fixes are listed '
+ 'in :py:mod:`pywikibot.fixes`.')
+ elif (line.endswith(':') and not line.strip().startswith(':')
and
+ 'Traceback (most recent call last)' not in line):
+ lines[index] = line + ':'
+ elif line.startswith('-'):
+ # Indent options
+ lines[index] = ' ' + line
+ elif line.startswith(' '):
+ # Indent description of options (as options are indented)
+ lines[index] = line.replace(' ', '
')
+ elif line.strip().startswith('python'):
+ # Indent commands
+ lines[index] = ' ' + line.strip()
def setup(app):
--
To view, visit
https://gerrit.wikimedia.org/r/225857
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9d5c09c6ac9b3c06b320d607165aac6bc20ff21c
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>