jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/487479 )
Change subject: [cleanup] dedent else clause of Category.copyAndKeep() ......................................................................
[cleanup] dedent else clause of Category.copyAndKeep()
Due to the previous return statement the else is not necessary. Keep the code flat not nested.
Change-Id: Ie14f08442f9096a08b77b0fe73b025241edc4c69 --- M pywikibot/page.py 1 file changed, 20 insertions(+), 20 deletions(-)
Approvals: Dvorapa: Looks good to me, but someone else must approve Zhuyifei1999: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py index 1718e08..1fbd1c2 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -3038,26 +3038,26 @@ pywikibot.warning('Target page %s already exists!' % target_cat.title()) return False - else: - pywikibot.output( - 'Moving text from %s to %s.' - % (self.title(), target_cat.title())) - authors = ', '.join(self.contributingUsers()) - creation_summary = message % (self.title(), authors) - newtext = self.get() - for regex_name in cfd_templates: - matchcfd = re.compile(r'{{%s.*?}}' % regex_name, re.IGNORECASE) - newtext = matchcfd.sub('', newtext) - matchcomment = re.compile( - r'<!--BEGIN CFD TEMPLATE-->.*?<!--END CFD TEMPLATE-->', - re.IGNORECASE | re.MULTILINE | re.DOTALL) - newtext = matchcomment.sub('', newtext) - pos = 0 - while (newtext[pos:pos + 1] == '\n'): - pos = pos + 1 - newtext = newtext[pos:] - target_cat.put(newtext, creation_summary) - return True + + pywikibot.output( + 'Moving text from {} to {}.' + .format(self.title(), target_cat.title())) + authors = ', '.join(self.contributingUsers()) + creation_summary = message % (self.title(), authors) + newtext = self.get() + for regex_name in cfd_templates: + matchcfd = re.compile(r'{{%s.*?}}' % regex_name, re.IGNORECASE) + newtext = matchcfd.sub('', newtext) + matchcomment = re.compile( + r'<!--BEGIN CFD TEMPLATE-->.*?<!--END CFD TEMPLATE-->', + re.IGNORECASE | re.MULTILINE | re.DOTALL) + newtext = matchcomment.sub('', newtext) + pos = 0 + while (newtext[pos:pos + 1] == '\n'): + pos = pos + 1 + newtext = newtext[pos:] + target_cat.put(newtext, creation_summary) + return True
@property def categoryinfo(self):
pywikibot-commits@lists.wikimedia.org