Skip to content

Commit

Permalink
fix #69 update for compatibility with bitarray 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pwoods25443 committed Nov 20, 2024
1 parent ec18ecc commit 40d23e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ais_tools/ais25.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def ais25_decode(body, pad):
# assume that the pad value was wrong and just ignore the extra bits at the end
new_len = (len(text_bits) // 6) * 6
text_bits = text_bits[:new_len]
message['text'] = ''.join(text_bits.iterdecode(ASCII8toASCII6_decode_tree))
message['text'] = ''.join(text_bits.decode(ASCII8toASCII6_decode_tree))

return message

Expand Down
6 changes: 3 additions & 3 deletions ais_tools/transcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def bits_to_nmea(bits):
pad = 0
else:
bits = bits + (pad * bitarray('0'))
return ''.join(bits.iterdecode(ASCII8toAIS6_decode_tree)), pad
return ''.join(bits.decode(ASCII8toAIS6_decode_tree)), pad


def nmea_to_bits(body, pad):
Expand Down Expand Up @@ -73,7 +73,7 @@ def to_nmea(self):
bits = self.bits
else:
bits = self.bits + (pad * bitarray('0'))
return ''.join(bits.iterdecode(ASCII8toAIS6_decode_tree)), pad
return ''.join(bits.decode(ASCII8toAIS6_decode_tree)), pad

def pack(self, struct, message):
self.pack_into(struct, self.offset, message)
Expand Down Expand Up @@ -225,4 +225,4 @@ def decode(self, value):
bits = bitarray()
bits.frombytes(value)
bits = bits[:self.nbits]
return ''.join(bits.iterdecode(ASCII8toASCII6_decode_tree))
return ''.join(bits.decode(ASCII8toASCII6_decode_tree))

0 comments on commit 40d23e7

Please sign in to comment.