Merge pull request #270 from khaledhosny/travis-failure
Fix make check on Travis
This commit is contained in:
commit
fca0c61d67
|
@ -7,7 +7,43 @@ from itertools import *
|
||||||
diff_symbols = "-+=*&^%$#@!~/"
|
diff_symbols = "-+=*&^%$#@!~/"
|
||||||
diff_colors = ['red', 'green', 'blue']
|
diff_colors = ['red', 'green', 'blue']
|
||||||
|
|
||||||
if sys.version_info[0] >= 3:
|
try:
|
||||||
|
unichr = unichr
|
||||||
|
|
||||||
|
if sys.maxunicode < 0x10FFFF:
|
||||||
|
# workarounds for Python 2 "narrow" builds with UCS2-only support.
|
||||||
|
|
||||||
|
_narrow_unichr = unichr
|
||||||
|
|
||||||
|
def unichr(i):
|
||||||
|
"""
|
||||||
|
Return the unicode character whose Unicode code is the integer 'i'.
|
||||||
|
The valid range is 0 to 0x10FFFF inclusive.
|
||||||
|
|
||||||
|
>>> _narrow_unichr(0xFFFF + 1)
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "<stdin>", line 1, in ?
|
||||||
|
ValueError: unichr() arg not in range(0x10000) (narrow Python build)
|
||||||
|
>>> unichr(0xFFFF + 1) == u'\U00010000'
|
||||||
|
True
|
||||||
|
>>> unichr(1114111) == u'\U0010FFFF'
|
||||||
|
True
|
||||||
|
>>> unichr(0x10FFFF + 1)
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "<stdin>", line 1, in ?
|
||||||
|
ValueError: unichr() arg not in range(0x110000)
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
return _narrow_unichr(i)
|
||||||
|
except ValueError:
|
||||||
|
try:
|
||||||
|
padded_hex_str = hex(i)[2:].zfill(8)
|
||||||
|
escape_str = "\\U" + padded_hex_str
|
||||||
|
return escape_str.decode("unicode-escape")
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
raise ValueError('unichr() arg not in range(0x110000)')
|
||||||
|
|
||||||
|
except NameError:
|
||||||
unichr = chr
|
unichr = chr
|
||||||
|
|
||||||
class ColorFormatter:
|
class ColorFormatter:
|
||||||
|
|
Loading…
Reference in New Issue