easybits 0.1.0__tar.gz → 0.1.2__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {easybits-0.1.0 → easybits-0.1.2}/PKG-INFO +1 -1
- {easybits-0.1.0 → easybits-0.1.2}/easybits/__init__.py +8 -3
- {easybits-0.1.0 → easybits-0.1.2}/pyproject.toml +1 -1
- {easybits-0.1.0 → easybits-0.1.2}/README.md +0 -0
- {easybits-0.1.0 → easybits-0.1.2}/easybits/errors.py +0 -0
- {easybits-0.1.0 → easybits-0.1.2}/easybits/util.py +0 -0
@@ -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
|
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
|
-
|
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)
|
File without changes
|
File without changes
|
File without changes
|