easybits 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
easybits/__init__.py CHANGED
@@ -25,8 +25,10 @@ class Bits(bitarray):
25
25
  def ones(cls, length):
26
26
  return Bits(ones(length))
27
27
 
28
- def __new__(cls, value, length=None, encoding='ascii'):
29
- if isinstance(value, bytes):
28
+ def __new__(cls, value=None, length=None, encoding='ascii'):
29
+ if value is None:
30
+ bits = bitarray(length or 0)
31
+ elif isinstance(value, bytes):
30
32
  bits = bitarray()
31
33
  bits.frombytes(value)
32
34
  elif isinstance(value, bool):
@@ -109,3 +111,6 @@ class Bits(bitarray):
109
111
  return ~self + Bits(1, length=len(self))
110
112
  else:
111
113
  return ~(self + Bits(-1, length=len(self)))
114
+
115
+ def concat(self, other):
116
+ return super().__add__(other)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: easybits
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: A friendly interface for exploring bits.
5
5
  Author: Chris Proctor
6
6
  Author-email: chris@chrisproctor.net
@@ -0,0 +1,6 @@
1
+ easybits/__init__.py,sha256=Hbz2irQzF8juhojdybx3S_jBX272Mgd_L1VCQIfpx6E,3286
2
+ easybits/errors.py,sha256=MPQGCYUave-PCKP4IkfIS2NJzL2j2KH2W3rlPofsigo,478
3
+ easybits/util.py,sha256=GYlFDgqk1sBkFidKsoo9xaO7QZ8_v7KFavP2KnV0mZ8,100
4
+ easybits-0.1.2.dist-info/METADATA,sha256=1prbZ3ZJEKyIh799B88gVfRJq9Og2I4aEytHsqw0Rhc,525
5
+ easybits-0.1.2.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
6
+ easybits-0.1.2.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- easybits/__init__.py,sha256=aOBwy6bMlijC54Ov9UVv4OW5i8jIQvuCwSOQUFkKQJ8,3144
2
- easybits/errors.py,sha256=MPQGCYUave-PCKP4IkfIS2NJzL2j2KH2W3rlPofsigo,478
3
- easybits/util.py,sha256=GYlFDgqk1sBkFidKsoo9xaO7QZ8_v7KFavP2KnV0mZ8,100
4
- easybits-0.1.1.dist-info/METADATA,sha256=mY5ZZDiL-S6wHFS2NppzyITreTRHKKyGVHCgY7p-nDM,525
5
- easybits-0.1.1.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
6
- easybits-0.1.1.dist-info/RECORD,,