Mercurial > public > mercurial-scm > hg-stable
diff tests/run-tests.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 | ff72bd52d56a |
children | 408a4eb41453 |
line wrap: on
line diff
--- a/tests/run-tests.py Fri Mar 06 10:52:44 2020 +0100 +++ b/tests/run-tests.py Fri Mar 06 13:27:41 2020 -0500 @@ -1553,7 +1553,7 @@ NEEDESCAPE = re.compile(br'[\x00-\x08\x0b-\x1f\x7f-\xff]').search ESCAPESUB = re.compile(br'[\x00-\x08\x0b-\x1f\\\x7f-\xff]').sub - ESCAPEMAP = dict((bchr(i), br'\x%02x' % i) for i in range(256)) + ESCAPEMAP = {bchr(i): br'\x%02x' % i for i in range(256)} ESCAPEMAP.update({b'\\': b'\\\\', b'\r': br'\r'}) def __init__(self, path, *args, **kwds): @@ -2524,7 +2524,7 @@ def savetimes(outputdir, result): saved = dict(loadtimes(outputdir)) maxruns = 5 - skipped = set([str(t[0]) for t in result.skipped]) + skipped = {str(t[0]) for t in result.skipped} for tdata in result.times: test, real = tdata[0], tdata[3] if test not in skipped: @@ -2737,7 +2737,7 @@ @staticmethod def _writexunit(result, outf): # See http://llg.cubic.org/docs/junit/ for a reference. - timesd = dict((t[0], t[3]) for t in result.times) + timesd = {t[0]: t[3] for t in result.times} doc = minidom.Document() s = doc.createElement('testsuite') s.setAttribute('errors', "0") # TODO @@ -3343,7 +3343,7 @@ tmpdir = os.path.join(self._hgtmp, b'child%d' % count) # extra keyword parameters. 'case' is used by .t tests - kwds = dict((k, testdesc[k]) for k in ['case'] if k in testdesc) + kwds = {k: testdesc[k] for k in ['case'] if k in testdesc} t = testcls( refpath,