easybits 0.1.0__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):
@@ -58,7 +60,7 @@ class Bits(bitarray):
58
60
  return super().__new__(cls, sized_bits)
59
61
 
60
62
  def __str__(self):
61
- bits = self.to01()
63
+ return self.to01()
62
64
 
63
65
  def __repr__(self):
64
66
  return self.to01()
@@ -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.0
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=qnmlE5N3MkBB6_pQavtgAK6uzV0dj0zi50puMmUwRGQ,3144
2
- easybits/errors.py,sha256=MPQGCYUave-PCKP4IkfIS2NJzL2j2KH2W3rlPofsigo,478
3
- easybits/util.py,sha256=GYlFDgqk1sBkFidKsoo9xaO7QZ8_v7KFavP2KnV0mZ8,100
4
- easybits-0.1.0.dist-info/METADATA,sha256=XnRyaeO0SiTqzWd6Q2GX0B7DWciDl38iylJbQgP_5Sc,525
5
- easybits-0.1.0.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
6
- easybits-0.1.0.dist-info/RECORD,,