mirror of https://github.com/dirtbags/netarch.git
Update trilobytes.py
Check byte for None instead of truthiness -- bytes with value of zero were getting overwritten by None.
This commit is contained in:
parent
d0b33d6ec5
commit
94ef0aba57
|
@ -84,7 +84,7 @@ class TriloBytes:
|
||||||
yield val
|
yield val
|
||||||
|
|
||||||
def __bytes__(self):
|
def __bytes__(self):
|
||||||
return bytes((v or d for v,d in zip(self,itertools.cycle(self._drop))))
|
return bytes((d if v is None else v for v,d in zip(self,itertools.cycle(self._drop))))
|
||||||
|
|
||||||
def __add__(self, other):
|
def __add__(self, other):
|
||||||
try:
|
try:
|
||||||
|
@ -107,7 +107,7 @@ class TriloBytes:
|
||||||
mask[0]
|
mask[0]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
mask = [mask]
|
mask = [mask]
|
||||||
return TriloBytes(((x^y if x else None) for x,y in zip(self._contents, itertools.cycle(mask))), drop=self._drop)
|
return TriloBytes(((None if x is None or y is None else x^y) for x,y in zip(self._contents, itertools.cycle(mask))), drop=self._drop)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue