Skip to content

Commit

Permalink
Merge pull request #206 from cjstep/ext-py-parquet-bitstring-fix
Browse files Browse the repository at this point in the history
[core] fixing extra bracket and missing paren in ext-py/parquet/bitstring.py
  • Loading branch information
romainr committed Jul 15, 2015
2 parents 4c02a42 + 95f9a24 commit 0a6d7b0
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions desktop/core/ext-py/parquet-python/parquet/bitstring.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@

SINGLE_BIT_MASK = [1 << x for x in range(7, -1, -1)]

]

class BitString(object):

def __init__(self, bytes, length=None, offset=None):
self.bytes = bytes
self.offset = offset if offset is not None else 0
self.length = length if length is not None else 8 * len(data) - self.offset


def __getitem__(self, key):
try:
start = key.start
stop = key.stop
except AttributeError:
if key < 0 or key >= length:
raise IndexError()
byte_index, bit_offset = divmod(self.offset + key), 8)
return self.bytes[byte_index] & SINGLE_BIT_MASK[bit_offset]
byte_index, bit_offset = (divmod(self.offset + key), 8)
return self.bytes[byte_index] & SINGLE_BIT_MASK[bit_offset]

0 comments on commit 0a6d7b0

Please sign in to comment.