Mercurial > hg-stable
diff i18n/polib.py @ 44470:9d2b2df2c2ba
cleanup: run pyupgrade on our source tree to clean up varying things
Built with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**' | xargs pyupgrade --keep-percent-format --keep-extraneous-parens
and then blackened. pyupgrade comes from
https://github.com/asottile/pyupgrade with a patch to let me preserve
extraneous parens (which we use for marking strings that shouldn't be
translated), and lets us clean up a bunch of idioms that have cruftily
accumulated over the years.
# skip-blame no-op automated code cleanups
Differential Revision: https://phab.mercurial-scm.org/D8255
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 06 Mar 2020 13:27:41 -0500 |
parents | 04e0e0e73892 |
children | 6000f5b25c9b |
line wrap: on
line diff
--- a/i18n/polib.py Fri Mar 06 10:52:44 2020 +0100 +++ b/i18n/polib.py Fri Mar 06 13:27:41 2020 -0500 @@ -722,8 +722,8 @@ object POFile, the reference catalog. """ # Store entries in dict/set for faster access - self_entries = dict((entry.msgid, entry) for entry in self) - refpot_msgids = set(entry.msgid for entry in refpot) + self_entries = {entry.msgid: entry for entry in self} + refpot_msgids = {entry.msgid for entry in refpot} # Merge entries that are in the refpot for entry in refpot: e = self_entries.get(entry.msgid) @@ -1808,9 +1808,9 @@ entry = self._build_entry( msgid=msgid_tokens[0], msgid_plural=msgid_tokens[1], - msgstr_plural=dict( - (k, v) for k, v in enumerate(msgstr.split(b('\0'))) - ), + msgstr_plural={ + k: v for k, v in enumerate(msgstr.split(b('\0'))) + }, ) else: entry = self._build_entry(msgid=msgid, msgstr=msgstr)