Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/ui.py @ 31034:219629d42786
ui: construct _keepalnum list in a python3-friendly way
It'll be more expensive, but it preserves the behavior.
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 16 Feb 2017 11:34:50 -0500 |
parents | 75e325ce538e |
children | 9c827087df38 |
comparison
equal
deleted
inserted
replaced
31033:693a5bb47854 | 31034:219629d42786 |
---|---|
37 ) | 37 ) |
38 | 38 |
39 urlreq = util.urlreq | 39 urlreq = util.urlreq |
40 | 40 |
41 # for use with str.translate(None, _keepalnum), to keep just alphanumerics | 41 # for use with str.translate(None, _keepalnum), to keep just alphanumerics |
42 _keepalnum = ''.join(c for c in map(chr, range(256)) if not c.isalnum()) | 42 if pycompat.ispy3: |
43 _bytes = [bytes([c]) for c in range(256)] | |
44 _notalnum = [s for s in _bytes if not s.isalnum()] | |
45 else: | |
46 _notalnum = [c for c in map(chr, range(256)) if not c.isalnum()] | |
47 _keepalnum = ''.join(_notalnum) | |
43 | 48 |
44 samplehgrcs = { | 49 samplehgrcs = { |
45 'user': | 50 'user': |
46 """# example user config (see 'hg help config' for more info) | 51 """# example user config (see 'hg help config' for more info) |
47 [ui] | 52 [ui] |