jenkins-bot merged this change.

View Change

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

- remove preleading "u" from strings
- use str.format() instead of modulo operator for changed lines

Change-Id: I140f7e27517c2d28fc50d6260ba846e93482b123
---
M scripts/version.py
1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/scripts/version.py b/scripts/version.py
index 4ce9170..840756b 100755
--- a/scripts/version.py
+++ b/scripts/version.py
@@ -41,9 +41,9 @@

def main(*args):
"""Print pywikibot version and important settings."""
- pywikibot.output('Pywikibot: %s' % getversion())
- pywikibot.output('Release version: %s' % pywikibot.__version__)
- pywikibot.output('requests version: %s' % requests.__version__)
+ pywikibot.output('Pywikibot: ' + getversion())
+ pywikibot.output('Release version: ' + pywikibot.__version__)
+ pywikibot.output('requests version: ' + requests.__version__)

has_wikimedia_cert = False
if (not hasattr(requests, 'certs') or
@@ -51,31 +51,30 @@
not callable(requests.certs.where)):
pywikibot.output(' cacerts: not defined')
elif not os.path.isfile(requests.certs.where()):
- pywikibot.output(' cacerts: %s (missing)' % requests.certs.where())
+ pywikibot.output(' cacerts: {} (missing)'.format(
+ requests.certs.where()))
else:
- pywikibot.output(' cacerts: %s' % requests.certs.where())
+ pywikibot.output(' cacerts: ' + requests.certs.where())

with codecs.open(requests.certs.where(), 'r', 'utf-8') as cert_file:
text = cert_file.read()
if WMF_CACERT in text:
has_wikimedia_cert = True
- pywikibot.output(u' certificate test: %s'
- % ('ok' if has_wikimedia_cert else 'not ok'))
+ pywikibot.output(' certificate test: {}'
+ .format(('ok' if has_wikimedia_cert else 'not ok')))
if not has_wikimedia_cert:
- pywikibot.output(
- ' Please reinstall requests!')
+ pywikibot.output(' Please reinstall requests!')

- pywikibot.output('Python: %s' % sys.version)
+ pywikibot.output('Python: ' + sys.version)

toolforge_env_hostname = get_toolforge_hostname()
if toolforge_env_hostname:
- pywikibot.output('Toolforge hostname: {0}'.format(
- toolforge_env_hostname))
+ pywikibot.output('Toolforge hostname: ' + toolforge_env_hostname)

check_environ('PYWIKIBOT_DIR')
check_environ('PYWIKIBOT_DIR_PWB')
check_environ('PYWIKIBOT_NO_USER_CONFIG')
- pywikibot.output('Config base dir: {0}'.format(pywikibot.config2.base_dir))
+ pywikibot.output('Config base dir: ' + pywikibot.config2.base_dir)
for family, usernames in pywikibot.config2.usernames.items():
if usernames:
pywikibot.output('Usernames for family "{0}":'.format(family))

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I140f7e27517c2d28fc50d6260ba846e93482b123
Gerrit-Change-Number: 462280
Gerrit-PatchSet: 3
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)