framing: fix PEP8

This commit is contained in:
Roman Zeyde
2014-12-31 13:31:08 +02:00
parent ffdfce78fc
commit 43ed34ede5
2 changed files with 8 additions and 3 deletions

View File

@@ -17,3 +17,6 @@ script:
- pep8 amodem/ scripts/ tests/ amodem-cli
- cd tests
- coverage run --source=amodem -m py.test
after_success:
- coveralls

View File

@@ -81,12 +81,14 @@ def chain_wrapper(func):
return itertools.chain.from_iterable(result)
return wrapped
class BitPacker(object):
word_size = 8
byte_size = 8
def __init__(self):
bits_list = []
for index in range(2 ** self.word_size):
bits = [index & (2 ** k) for k in range(self.word_size)]
for index in range(2 ** self.byte_size):
bits = [index & (2 ** k) for k in range(self.byte_size)]
bits_list.append(tuple((1 if b else 0) for b in bits))
self.to_bits = dict((i, bits) for i, bits in enumerate(bits_list))