(self, size, bits)
| 13 | |
| 14 | class BitArray(object): |
| 15 | def __init__(self, size, bits): |
| 16 | self.size = size |
| 17 | if len(bits) > size: |
| 18 | raise ValueError("size > len(bits)") |
| 19 | |
| 20 | bits_list = [] |
| 21 | for bit in bits: |
| 22 | x = int(bit) |
| 23 | if x not in [0, 1]: |
| 24 | raise ValueError("Not expected bits value {0}".format(x)) |
| 25 | bits_list.append(x) |
| 26 | |
| 27 | self.array = bits_list |
| 28 | if size > len(self.array): |
| 29 | self.array = ([0] * (size - len(self.array))) + self.array |
| 30 | |
| 31 | def copy(self): |
| 32 | new = type(self)(0, "") |
nothing calls this directly
no outgoing calls
no test coverage detected