Skip to content

Commit b432829

Browse files
committed
Linting and adding typing package to requirements file
1 parent 76a0bf8 commit b432829

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

adafruit_pixel_framebuf.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@
3939

4040
# imports
4141
try:
42-
from typing import Union
43-
44-
from adafruit_dotstar import DotStar
45-
from neopixel import NeoPixel
42+
from circuitpython_typing.led import FillBasedColorUnion
4643
except ImportError:
4744
pass
4845

@@ -77,9 +74,10 @@ class PixelFramebuffer(adafruit_framebuf.FrameBuffer):
7774
7875
"""
7976

77+
# pylint: disable=too-many-arguments
8078
def __init__(
8179
self,
82-
pixels: Union[NeoPixel, DotStar],
80+
pixels: FillBasedColorUnion,
8381
width: int,
8482
height: int,
8583
orientation: int = HORIZONTAL,
@@ -89,7 +87,7 @@ def __init__(
8987
top: int = 0,
9088
bottom: int = 0,
9189
rotation: int = 0,
92-
) -> None: # pylint: disable=too-many-arguments
90+
) -> None:
9391
self._width = width
9492
self._height = height
9593

@@ -107,7 +105,9 @@ def __init__(
107105

108106
self._buffer = bytearray(width * height * 3)
109107
self._double_buffer = bytearray(width * height * 3)
110-
super().__init__(self._buffer, width, height, buf_format=adafruit_framebuf.RGB888)
108+
super().__init__(
109+
self._buffer, width, height, buf_format=adafruit_framebuf.RGB888
110+
)
111111
self.rotation = rotation
112112

113113
def blit(self) -> None:
@@ -119,7 +119,12 @@ def display(self) -> None:
119119
for _y in range(self._height):
120120
for _x in range(self._width):
121121
index = (_y * self.stride + _x) * 3
122-
if self._buffer[index : index + 3] != self._double_buffer[index : index + 3]:
122+
if (
123+
self._buffer[index : index + 3]
124+
!= self._double_buffer[index : index + 3]
125+
):
123126
self._grid[(_x, _y)] = tuple(self._buffer[index : index + 3])
124-
self._double_buffer[index : index + 3] = self._buffer[index : index + 3]
127+
self._double_buffer[index : index + 3] = self._buffer[
128+
index : index + 3
129+
]
125130
self._grid.show()

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
Adafruit-Blinka
66
adafruit-circuitpython-framebuf>=1.4.2
77
adafruit-circuitpython-led-animation
8+
adafruit-circuitpython-typing ~=1.4

0 commit comments

Comments
 (0)