comparison mercurial/store.py @ 44452: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 a61287a95dc3
children 909dafff6a78
comparison
equal deleted inserted replaced
44449:ff72bd52d56a 44452:9d2b2df2c2ba
135 e = b'_' 135 e = b'_'
136 xchr = pycompat.bytechr 136 xchr = pycompat.bytechr
137 asciistr = list(map(xchr, range(127))) 137 asciistr = list(map(xchr, range(127)))
138 capitals = list(range(ord(b"A"), ord(b"Z") + 1)) 138 capitals = list(range(ord(b"A"), ord(b"Z") + 1))
139 139
140 cmap = dict((x, x) for x in asciistr) 140 cmap = {x: x for x in asciistr}
141 for x in _reserved(): 141 for x in _reserved():
142 cmap[xchr(x)] = b"~%02x" % x 142 cmap[xchr(x)] = b"~%02x" % x
143 for x in capitals + [ord(e)]: 143 for x in capitals + [ord(e)]:
144 cmap[xchr(x)] = e + xchr(x).lower() 144 cmap[xchr(x)] = e + xchr(x).lower()
145 145
198 'hello~3aworld~3f' 198 'hello~3aworld~3f'
199 >>> f(b'the\\x07quick\\xADshot') 199 >>> f(b'the\\x07quick\\xADshot')
200 'the~07quick~adshot' 200 'the~07quick~adshot'
201 ''' 201 '''
202 xchr = pycompat.bytechr 202 xchr = pycompat.bytechr
203 cmap = dict([(xchr(x), xchr(x)) for x in pycompat.xrange(127)]) 203 cmap = {xchr(x): xchr(x) for x in pycompat.xrange(127)}
204 for x in _reserved(): 204 for x in _reserved():
205 cmap[xchr(x)] = b"~%02x" % x 205 cmap[xchr(x)] = b"~%02x" % x
206 for x in range(ord(b"A"), ord(b"Z") + 1): 206 for x in range(ord(b"A"), ord(b"Z") + 1):
207 cmap[xchr(x)] = xchr(x).lower() 207 cmap[xchr(x)] = xchr(x).lower()
208 208