jenkins-bot merged this change.
[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(-)
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):
To view, visit change 487479. To unsubscribe, or for help writing mail filters, visit settings.