formating

This commit is contained in:
jposada2020 2025-02-05 17:10:48 -05:00
parent c7dc901791
commit 34bcf3c535
4 changed files with 22 additions and 13 deletions

View file

@ -37,17 +37,15 @@ class Blink(ColorCycle):
:param pixel_object: The initialised LED object.
:param float speed: Animation speed in seconds, e.g. ``0.1``.
:param color: Animation color in ``(r, g, b)`` tuple, or ``0x000000`` hex format.
:param background_color: Background color in ``(r, g, b)`` tuple, or ``0x000000`` hex format. Defaults to BLACK.
:param background_color: Background color in ``(r, g, b)`` tuple, or ``0x000000``
hex format. Defaults to BLACK.
:param name: A human-readable name for the Animation. Used by the string function.
"""
def __init__(
self, pixel_object, speed, color, background_color=BLACK, name=None
):
# pylint: disable=too-many-arguments
def __init__(self, pixel_object, speed, color, background_color=BLACK, name=None):
self._background_color = background_color
super().__init__(
pixel_object, speed, [color, background_color], name=name
)
super().__init__(pixel_object, speed, [color, background_color], name=name)
def _set_color(self, color):
self.colors = [color, self._background_color]

View file

@ -44,7 +44,13 @@ class Volume(Animation):
# pylint: disable=too-many-arguments
def __init__(
self, pixel_object, speed, brightest_color, decoder, max_volume=500, name=None
self,
pixel_object,
speed,
brightest_color,
decoder,
max_volume=500,
name=None,
):
self._decoder = decoder
self._num_pixels = len(pixel_object)
@ -89,8 +95,15 @@ class Volume(Animation):
)
lit_pixels = int(
map_range(self._decoder.rms_level, 0, self._max_volume, 0, self._num_pixels)
map_range(
self._decoder.rms_level,
0,
self._max_volume,
0,
self._num_pixels,
)
)
# pylint: disable=consider-using-min-builtin
if lit_pixels > self._num_pixels:
lit_pixels = self._num_pixels

View file

@ -73,7 +73,7 @@ class AnimationSequence:
animations.animate()
"""
# pylint: disable=too-many-instance-attributes
# pylint: disable=too-many-instance-attributes, too-many-arguments
def __init__(
self,
*members,

View file

@ -21,9 +21,7 @@ pixel_pin = board.A3
# Update to match the number of NeoPixels you have connected
pixel_num = 30
pixels = neopixel.NeoPixel(
pixel_pin, pixel_num, brightness=0.5, auto_write=False
)
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False)
blink = Blink(pixels, speed=0.5, color=PURPLE, background_color=YELLOW)