diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 354c761..8810708 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,5 +30,5 @@ repos: name: pylint (examples code) description: Run pylint rules on "examples/*.py" files entry: /usr/bin/env bash -c - args: ['([[ ! -d "examples" ]] || for example in $(find . -path "./examples/*.py"); do pylint --disable=missing-docstring,invalid-name $example; done)'] + args: ['([[ ! -d "examples" ]] || for example in $(find . -path "./examples/*.py"); do pylint --disable=missing-docstring,invalid-name,consider-using-f-string $example; done)'] language: system diff --git a/adafruit_led_animation/animation/rainbowchase.py b/adafruit_led_animation/animation/rainbowchase.py index 4a74bd4..3f84828 100644 --- a/adafruit_led_animation/animation/rainbowchase.py +++ b/adafruit_led_animation/animation/rainbowchase.py @@ -40,7 +40,7 @@ class RainbowChase(Chase): :param size: Number of pixels to turn on in a row. :param spacing: Number of pixels to turn off in a row. :param reverse: Reverse direction of movement. - :param step: How many colors to skip in `colorwheel` per bar (default 8) + :param step: How many colors to skip in ``colorwheel`` per bar (default 8) """ # pylint: disable=too-many-arguments diff --git a/adafruit_led_animation/color.py b/adafruit_led_animation/color.py index e4974de..9f8b17a 100644 --- a/adafruit_led_animation/color.py +++ b/adafruit_led_animation/color.py @@ -23,6 +23,9 @@ * Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads """ +# Makes colorwheel() available. +from rainbowio import colorwheel # pylint: disable=unused-import + RED = (255, 0, 0) """Red.""" YELLOW = (255, 150, 0) @@ -70,29 +73,6 @@ """RAINBOW is a list of colors to use for cycling through. Includes, in order: red, orange, yellow, green, blue, and purple.""" -try: - try: - # Backwards compatibility for 5.3.0 and prior - from _pixelbuf import colorwheel # pylint: disable=unused-import - except ImportError: - from _pixelbuf import wheel as colorwheel # pylint: disable=unused-import -except ImportError: - - def colorwheel(pos): - """Colorwheel is built into CircuitPython's _pixelbuf. A separate colorwheel is included - here for use with CircuitPython builds that do not include _pixelbuf, as with some of the - SAMD21 builds. To use: input a value 0 to 255 to get a color value. - The colours are a transition from red to green to blue and back to red.""" - if pos < 0 or pos > 255: - return 0, 0, 0 - if pos < 85: - return int(255 - pos * 3), int(pos * 3), 0 - if pos < 170: - pos -= 85 - return 0, int(255 - pos * 3), int(pos * 3) - pos -= 170 - return int(pos * 3), 0, int(255 - (pos * 3)) - def calculate_intensity(color, intensity=1.0): """ diff --git a/docs/conf.py b/docs/conf.py index e860da5..ded1695 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -25,7 +25,7 @@ # Uncomment the below if you use native CircuitPython modules such as # digitalio, micropython and busio. List the modules you use. Without it, the # autodoc module docs will fail to generate with a warning. -autodoc_mock_imports = [] +autodoc_mock_imports = ["rainbowio"] intersphinx_mapping = {