From f776a93be5f3cd56e1972da41385147b60e6ebec Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Fri, 9 Dec 2022 21:13:59 -0500 Subject: [PATCH 1/2] Change signature to match builtin --- adafruit_pixelbuf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adafruit_pixelbuf.py b/adafruit_pixelbuf.py index 8db9bf6..4018326 100644 --- a/adafruit_pixelbuf.py +++ b/adafruit_pixelbuf.py @@ -44,7 +44,8 @@ class PixelBuf: # pylint: disable=too-many-instance-attributes def __init__( # pylint: disable=too-many-locals,too-many-arguments self, - n: int, + size: int, + *, byteorder: str = "BGR", brightness: float = 1.0, auto_write: bool = False, From b1af6b54cfa531fa2bac81b86d1f0ddfa95b63a7 Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Tue, 13 Dec 2022 14:42:59 -0500 Subject: [PATCH 2/2] Use new argument in __init__() --- adafruit_pixelbuf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_pixelbuf.py b/adafruit_pixelbuf.py index 4018326..2ba7262 100644 --- a/adafruit_pixelbuf.py +++ b/adafruit_pixelbuf.py @@ -58,7 +58,7 @@ def __init__( # pylint: disable=too-many-locals,too-many-arguments self.auto_write = False effective_bpp = 4 if dotstar_mode else bpp - _bytes = effective_bpp * n + _bytes = effective_bpp * size buf = bytearray(_bytes) offset = 0 @@ -73,7 +73,7 @@ def __init__( # pylint: disable=too-many-locals,too-many-arguments raise TypeError("trailer must be a bytearray") buf += trailer - self._pixels = n + self._pixels = size self._bytes = _bytes self._byteorder = byteorder_tuple self._byteorder_string = byteorder