fix some py2/py3-isms picked up by mypy

These happened to work, but it's probably best to get the types right.
This commit is contained in:
Brian Warner 2016-12-08 23:47:53 -08:00
parent fa9285910d
commit f0bfcd7ca4
2 changed files with 6 additions and 5 deletions

View File

@ -102,5 +102,6 @@ def input_code_with_completion(prompt, initial_channelids, get_channel_ids,
return code
if __name__ == "__main__":
code = input_code_with_completion("Enter wormhole code: ", lambda: [], 2)
code = input_code_with_completion("Enter wormhole code: ",
[], lambda: [], 2)
print("code is:", code)

View File

@ -139,11 +139,11 @@ raw_words = {
'FE': ['woodlark', 'yesteryear'], 'FF': ['Zulu', 'Yucatan']
};
byte_to_even_word = dict([(unhexlify(k), both_words[0])
byte_to_even_word = dict([(unhexlify(k.encode("ascii")), both_words[0])
for k,both_words
in raw_words.items()])
byte_to_odd_word = dict([(unhexlify(k), both_words[1])
byte_to_odd_word = dict([(unhexlify(k.encode("ascii")), both_words[1])
for k,both_words
in raw_words.items()])
even_words_lowercase, odd_words_lowercase = set(), set()
@ -152,7 +152,7 @@ for k,both_words in raw_words.items():
even_word, odd_word = both_words
even_words_lowercase.add(even_word.lower())
even_words_lowercase_to_byte[even_word.lower()] = unhexlify(k)
even_words_lowercase_to_byte[even_word.lower()] = unhexlify(k.encode("ascii"))
odd_words_lowercase.add(odd_word.lower())
odd_words_lowercase_to_byte[odd_word.lower()] = unhexlify(k)
odd_words_lowercase_to_byte[odd_word.lower()] = unhexlify(k.encode("ascii"))