py26 compatibility

This commit is contained in:
Henning Peters 2016-02-10 14:32:54 +01:00
parent 5c60847341
commit 3b5f1e753b
2 changed files with 2 additions and 6 deletions

View File

@ -64,10 +64,6 @@ MOD_NAMES = [
'spacy.symbols']
if sys.version_info[:2] < (2, 7) or (3, 0) <= sys.version_info[0:2] < (3, 4):
raise RuntimeError('Python version 2.7 or >= 3.4 required.')
# By subclassing build_extensions we have the actual compiler that will be used
# which is really known only after finalize_options
# http://stackoverflow.com/questions/724664/python-distutils-how-to-get-a-compiler-that-is-going-to-be-used

View File

@ -58,7 +58,7 @@ def test_round_trip():
message = ['the', 'quick', 'brown', 'fox', 'jumped', 'over', 'the',
'the', 'lazy', 'dog', '.']
strings = list(codec.strings)
codes = {codec.leaves[i]: strings[i] for i in range(len(codec.leaves))}
codes = dict([(codec.leaves[i], strings[i]) for i in range(len(codec.leaves))])
bits = codec.encode(message)
string = ''.join('{0:b}'.format(c).rjust(8, '0')[::-1] for c in bits.as_bytes())
for word in message:
@ -83,7 +83,7 @@ def test_rosetta():
codec = HuffmanCodec(symb2freq.items())
py_codec = py_encode(symb2freq)
codes = {codec.leaves[i]: codec.strings[i] for i in range(len(codec.leaves))}
codes = dict([(codec.leaves[i], codec.strings[i]) for i in range(len(codec.leaves))])
my_lengths = defaultdict(int)
py_lengths = defaultdict(int)