jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[cleanup] cleanup scripts/newitem.py

- remove preleading "u" fron strings
- use single quotes for string literals and double quotes
**only** if they consist of single quotes within them
- use str.format(...) instead of modulo for type specifier
arguments

Change-Id: I84b6e27a75eed4f111e423d3a18db408fcbfc06a
---
M scripts/newitem.py
1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/scripts/newitem.py b/scripts/newitem.py
index aab642f..64e3360 100755
--- a/scripts/newitem.py
+++ b/scripts/newitem.py
@@ -56,9 +56,9 @@
days=self.pageAge)
self.lastEditBefore = self.repo.getcurrenttime() - timedelta(
days=self.lastEdit)
- pywikibot.output('Page age is set to %s days so only pages created'
- '\nbefore %s will be considered.'
- % (self.pageAge, self.pageAgeBefore.isoformat()))
+ pywikibot.output('Page age is set to {0} days so only pages created'
+ '\nbefore {1} will be considered.'
+ .format(self.pageAge, self.pageAgeBefore.isoformat()))
pywikibot.output(
'Last edit is set to {0} days so only pages last edited'
'\nbefore {1} will be considered.'.format(
@@ -85,34 +85,36 @@
def treat_page_and_item(self, page, item):
"""Treat page/item."""
if item and item.exists():
- pywikibot.output(u'%s already has an item: %s.' % (page, item))
+ pywikibot.output('{0} already has an item: {1}.'
+ .format(page, item))
if self.getOption('touch'):
- pywikibot.output(u'Doing a null edit on the page.')
+ pywikibot.output('Doing a null edit on the page.')
self._touch_page(page)
return

if page.isRedirectPage():
- pywikibot.output(u'%s is a redirect page. Skipping.' % page)
+ pywikibot.output('{0} is a redirect page. Skipping.'.format(page))
return
if page.editTime() > self.lastEditBefore:
pywikibot.output(
- u'Last edit on %s was on %s.\nToo recent. Skipping.'
- % (page, page.editTime().isoformat()))
+ 'Last edit on {0} was on {1}.\nToo recent. Skipping.'
+ .format(page, page.editTime().isoformat()))
return

if page.oldest_revision.timestamp > self.pageAgeBefore:
pywikibot.output(
- u'Page creation of %s on %s is too recent. Skipping.'
- % (page, page.editTime().isoformat()))
+ 'Page creation of {0} on {1} is too recent. Skipping.'
+ .format(page, page.editTime().isoformat()))
return
if page.isCategoryRedirect():
- pywikibot.output('%s is a category redirect. Skipping.' % page)
+ pywikibot.output('{0} is a category redirect. Skipping.'
+ .format(page))
return

if page.langlinks():
# FIXME: Implement this
pywikibot.output(
- "Found language links (interwiki links).\n"
+ 'Found language links (interwiki links).\n'
"Haven't implemented that yet so skipping.")
return

@@ -155,5 +157,5 @@
return True


-if __name__ == "__main__":
+if __name__ == '__main__':
main()

To view, visit change 462463. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I84b6e27a75eed4f111e423d3a18db408fcbfc06a
Gerrit-Change-Number: 462463
Gerrit-PatchSet: 2
Gerrit-Owner: D3r1ck01 <alangiderick@gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick@gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)