jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463052 )
Change subject: [cleanup] cleanup scripts/maintenance/make_i18n_dict.py ......................................................................
[cleanup] cleanup scripts/maintenance/make_i18n_dict.py
- use str.format(...) instead of modulo for type specifier arguments. - use single quotes for string literals - remove preleading "u" from strings - use "+" to concatenate strings in some cases
Change-Id: I5788e1117e5a888cd6b0303924a703561af6efed --- M scripts/maintenance/make_i18n_dict.py 1 file changed, 10 insertions(+), 10 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/maintenance/make_i18n_dict.py b/scripts/maintenance/make_i18n_dict.py index bdad8db..479295e 100755 --- a/scripts/maintenance/make_i18n_dict.py +++ b/scripts/maintenance/make_i18n_dict.py @@ -80,17 +80,17 @@ keys.remove('en') keys.insert(0, 'en')
- print("# -*- coding: utf-8 -*-") - print("msg = {") + print('# -*- coding: utf-8 -*-') + print('msg = {') for code in keys: print(" '%s': {" % code) for msg in sorted(self.messages.values()): - label = "%s-%s" % (self.scriptname, msg) + label = '{}-{}'.format(self.scriptname, msg) if label in self.dict[code]: print(" '%s': u'%s'," % (label, self.dict[code][label])) - print(" },") - print("};") + print(' },') + print('};')
def read(self, oldmsg, newmsg=None): """Read a single message from source script.""" @@ -100,19 +100,19 @@ if newmsg is None: newmsg = oldmsg for code in keys: - label = "%s-%s" % (self.scriptname, newmsg) + label = '{}-{}'.format(self.scriptname, newmsg) if code == 'qqq': if code not in self.dict: self.dict[code] = {} self.dict[code][label] = ( - u'Edit summary for message %s of %s report' - % (newmsg, self.scriptname)) + 'Edit summary for message {} of {} report' + .format(newmsg, self.scriptname)) elif code != 'commons': if code not in self.dict: self.dict[code] = {} self.dict[code][label] = msg[code] if 'en' not in keys: - print('WARNING: "en" key missing for message %s' % newmsg) + print('WARNING: "en" key missing for message ' + newmsg)
def run(self, quiet=False): """ @@ -142,7 +142,7 @@ if not os.path.exists(json_dir): os.makedirs(json_dir) for lang in self.dict: - file_name = os.path.join(json_dir, '%s.json' % lang) + file_name = os.path.join(json_dir, '{}.json'.format(lang)) if os.path.isfile(file_name): with codecs.open(file_name, 'r', 'utf-8') as json_file: new_dict = json.loads(json_file.read())
pywikibot-commits@lists.wikimedia.org