jenkins-bot merged this change.

View Change

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

- use str.format(...) instead of modulo for type specifier
arguments.
- use single quotes for string literals
- remove preleading "u" fron strings

Change-Id: I8fe5cbc35f06a52a2aec028008512e052be0060e
---
M scripts/add_text.py
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/add_text.py b/scripts/add_text.py
index 77e408a..c76daa0 100755
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -143,7 +143,7 @@
summary = i18n.twtranslate(site, 'add_text-adding',
{'adding': addText[:200]})
if putText:
- pywikibot.output(u'Loading %s...' % page.title())
+ pywikibot.output('Loading {}...'.format(page.title()))

text = get_text(page, oldTextGiven, create)
if text is None:
@@ -158,7 +158,7 @@
pywikibot.output(
'Exception! regex (or word) used with -exceptUrl '
'is in the page. Skip!\n'
- 'Match was: %s' % result)
+ 'Match was: {}'.format(result))
return (False, False, always)
if regexSkip is not None:
result = re.findall(regexSkip, text)
@@ -166,7 +166,7 @@
pywikibot.output(
'Exception! regex (or word) used with -except '
'is in the page. Skip!\n'
- 'Match was: %s' % result)
+ 'Match was: {}'.format(result))
return (False, False, always)
# If not up, text put below
if not up:
@@ -184,7 +184,7 @@
newtext = textlib.removeLanguageLinks(newtext, site)

# Adding the text
- newtext += u"%s%s" % (config.line_separator, addText)
+ newtext += '{}{}'.format(config.line_separator, addText)
# Reputting the categories
newtext = textlib.replaceCategoryLinks(newtext,
categoriesInside, site,
@@ -193,7 +193,7 @@
newtext = textlib.replaceLanguageLinks(newtext, interwikiInside,
site)
else:
- newtext += u"%s%s" % (config.line_separator, addText)
+ newtext += '{}{}'.format(config.line_separator, addText)
else:
newtext = addText + config.line_separator + text

@@ -305,5 +305,5 @@
create=talkPage)


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

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8fe5cbc35f06a52a2aec028008512e052be0060e
Gerrit-Change-Number: 462800
Gerrit-PatchSet: 1
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)