comparison mercurial/util.py @ 30054:8b89521a69ba

util: use string.hexdigits instead of defining it ourselves This resolves some Python 3 weirdness.
author Augie Fackler <augie@google.com>
date Fri, 07 Oct 2016 08:58:23 -0400
parents dbcef8918bbd
children 81d38478fced
comparison
equal deleted inserted replaced
30053:dbcef8918bbd 30054:8b89521a69ba
26 import os 26 import os
27 import re as remod 27 import re as remod
28 import shutil 28 import shutil
29 import signal 29 import signal
30 import socket 30 import socket
31 import string
31 import subprocess 32 import subprocess
32 import sys 33 import sys
33 import tempfile 34 import tempfile
34 import textwrap 35 import textwrap
35 import time 36 import time
2295 2296
2296 If s is not a valid boolean, returns None. 2297 If s is not a valid boolean, returns None.
2297 """ 2298 """
2298 return _booleans.get(s.lower(), None) 2299 return _booleans.get(s.lower(), None)
2299 2300
2300 _hexdig = '0123456789ABCDEFabcdef'
2301 _hextochr = dict((a + b, chr(int(a + b, 16))) 2301 _hextochr = dict((a + b, chr(int(a + b, 16)))
2302 for a in _hexdig for b in _hexdig) 2302 for a in string.hexdigits for b in string.hexdigits)
2303 2303
2304 def _urlunquote(s): 2304 def _urlunquote(s):
2305 """Decode HTTP/HTML % encoding. 2305 """Decode HTTP/HTML % encoding.
2306 2306
2307 >>> _urlunquote('abc%20def') 2307 >>> _urlunquote('abc%20def')