Skip to content

Commit c3b868b

Browse files
committed
fixed formating issue identified by black and pylint
1 parent 5f56db7 commit c3b868b

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

adafruit_led_animation/animation/sparkle.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,17 @@ def _set_color(self, color):
9090
def _random_in_mask(self):
9191
if len(self._mask) == 0:
9292
return random.randint(0, (len(self.pixel_object) - 1))
93-
else:
94-
return self._mask[random.randint(0, (len(self._mask)-1))]
93+
else:
94+
return self._mask[random.randint(0, (len(self._mask) - 1))]
9595

9696
def draw(self):
97-
self._pixels = [
98-
self._random_in_mask()
99-
for _ in range(self._num_sparkles)
100-
]
97+
self._pixels = [self._random_in_mask() for _ in range(self._num_sparkles)]
10198
for pixel in self._pixels:
10299
self.pixel_object[pixel] = self._sparkle_color
103100

104101
def after_draw(self):
105102
self.show()
106103
for pixel in self._pixels:
107104
self.pixel_object[pixel % self._num_pixels] = self._half_color
108-
if (pixel+1) % self._num_pixels in self._mask: self.pixel_object[(pixel + 1) % self._num_pixels] = self._dim_color
109-
105+
if (pixel + 1) % self._num_pixels in self._mask:
106+
self.pixel_object[(pixel + 1) % self._num_pixels] = self._dim_color

examples/led_animation_sparkle_animations.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010

1111
from adafruit_led_animation.animation.sparkle import Sparkle
1212
from adafruit_led_animation.sequence import AnimationSequence
13-
from adafruit_led_animation.color import AMBER, JADE, AQUA, PINK
13+
from adafruit_led_animation.color import JADE, AQUA, PINK
1414

15-
# Update to match the pin connected to your NeoPixels
15+
# Update to match the pin connected to your NeoPixels
1616
pixel_pin = board.A1
1717
# Update to match the number of NeoPixels you have connected
1818
pixel_num = 64
19+
# fmt: off
1920
heart_mask = [ 1, 2, 5, 6,
2021
8, 9, 10, 11, 12, 13, 14, 15,
2122
16, 17, 18, 19, 20, 21, 22, 23,
@@ -32,15 +33,17 @@
3233
40, 41, 46, 47,
3334
48, 49, 50, 53, 54, 55,
3435
56, 57, 58, 59, 60, 61, 62, 63]
36+
# fmt: on
3537

3638
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.9, auto_write=False)
3739

3840
animations = AnimationSequence(
3941
Sparkle(pixels, speed=0.05, color=JADE, num_sparkles=1, mask=unheart_mask),
4042
Sparkle(pixels, speed=0.05, color=AQUA, num_sparkles=1),
4143
Sparkle(pixels, speed=0.05, color=PINK, num_sparkles=1, mask=heart_mask),
42-
advance_interval=5, auto_clear=False,
44+
advance_interval=5,
45+
auto_clear=False,
4346
)
44-
47+
4548
while True:
46-
animations.animate()
49+
animations.animate()

0 commit comments

Comments
 (0)