From c34da0bb141ee6da8cc5d029853290c4f6923256 Mon Sep 17 00:00:00 2001 From: Jonathan Perret Date: Thu, 27 Jun 2024 18:34:28 +0200 Subject: [PATCH] Switch back to maintained bitarray package The `bitarray-hardbyte` package on PyPI stopped being updated back in 2022 when its packaging improvements were reintegrated into the main `bitarray` project, see https://github.com/ilanschnell/bitarray/issues/165#issuecomment-1054075870 There doesn't seem to be a reason to depend on the `bitarray-hardbyte` package which is no longer maintained. We now depend on the current release of `bitarray` (2.9.2) which among other things initializes new arrays to zero, which could help avoid some obscure bugs. This guaranteed initialization is now used in two places where a temporary `[False, False...]` array was previously constructed just to initialize a `bitarray`. --- requirements.build.txt | 2 +- src/main/python/main/ayab/engine/control.py | 2 +- src/main/python/main/ayab/engine/pattern.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.build.txt b/requirements.build.txt index 4f7cb43e..b7f84d36 100644 --- a/requirements.build.txt +++ b/requirements.build.txt @@ -4,7 +4,7 @@ PyInstaller==6.4.0 Pillow==10 pyserial==3.5 sliplib==0.6.2 -bitarray-hardbyte==2.3.8 +bitarray==2.9.2 simpleaudio==1.0.4 wave==0.0.2 numpy==1.26.4 diff --git a/src/main/python/main/ayab/engine/control.py b/src/main/python/main/ayab/engine/control.py index 40845535..6c9fb694 100644 --- a/src/main/python/main/ayab/engine/control.py +++ b/src/main/python/main/ayab/engine/control.py @@ -265,7 +265,7 @@ def __update_status(self, line_number: int, color: int, bits: bitarray) -> None: def select_needles_API6( self, color: int, row_index: int, blank_line: bool ) -> bitarray: - bits = bitarray([False] * self.machine.width, endian="little") + bits = bitarray(self.machine.width, endian="little") # select needles flanking the pattern # if necessary to knit the background color diff --git a/src/main/python/main/ayab/engine/pattern.py b/src/main/python/main/ayab/engine/pattern.py index d103305f..b50f0cf1 100644 --- a/src/main/python/main/ayab/engine/pattern.py +++ b/src/main/python/main/ayab/engine/pattern.py @@ -59,7 +59,7 @@ def __convert(self) -> None: [0 for i in range(self.__num_colors)] for j in range(self.__pat_height) ] # unused self.__pattern_expanded = [ - bitarray([False] * self.__pat_width) + bitarray(self.__pat_width) for j in range(self.__num_colors * self.__pat_height) ]