Skip to content

Commit

Permalink
Add sized to bitarray to support mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
mlouielu committed Jul 3, 2017
1 parent e8ba27f commit d5bb98e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nand2vm/bitarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
# found in the LICENSE file.
#

from typing import Sized

class BitArray(object):

class BitArray(Sized):
"""This bitarray data is store with small endian, display with big endian"""
DEFAULT_BITS = 16

Expand Down Expand Up @@ -40,7 +42,7 @@ def __repr__(self):
"""Display big endian for debugging"""
return ''.join(['1' if s else '0' for s in self.data[::-1]])

def __len__(self):
def __len__(self) -> int:
return len(self.data)

def __eq__(self, other):
Expand Down

0 comments on commit d5bb98e

Please sign in to comment.