Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/ui.py @ 31263:64596338ba10
py3: factor out bytechr() function
I also changed xrange(127) to range(127) as the number is relatively small.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 08 Mar 2017 22:30:12 +0900 |
parents | 81e289ef9376 |
children | 66f1c244b43a |
comparison
equal
deleted
inserted
replaced
31262:e7a35f18d91f | 31263:64596338ba10 |
---|---|
38 ) | 38 ) |
39 | 39 |
40 urlreq = util.urlreq | 40 urlreq = util.urlreq |
41 | 41 |
42 # for use with str.translate(None, _keepalnum), to keep just alphanumerics | 42 # for use with str.translate(None, _keepalnum), to keep just alphanumerics |
43 if pycompat.ispy3: | 43 _keepalnum = ''.join(c for c in map(pycompat.bytechr, range(256)) |
44 _bytes = [bytes([c]) for c in range(256)] | 44 if not c.isalnum()) |
45 _notalnum = [s for s in _bytes if not s.isalnum()] | |
46 else: | |
47 _notalnum = [c for c in map(chr, range(256)) if not c.isalnum()] | |
48 _keepalnum = ''.join(_notalnum) | |
49 | 45 |
50 samplehgrcs = { | 46 samplehgrcs = { |
51 'user': | 47 'user': |
52 """# example user config (see 'hg help config' for more info) | 48 """# example user config (see 'hg help config' for more info) |
53 [ui] | 49 [ui] |