adafruit/Adafruit_CircuitPython_LED_Animation

Missing Type Annotations

FoamyGuy opened this issue · 0 comments

There are missing type annotations for some functions in this library.

The typing module does not exist on CircuitPython devices so the import needs to be wrapped in try/except to catch the error for missing import. There is an example of how that is done here:

try:
    from typing import List, Tuple
except ImportError:
    pass

Once imported the typing annotations for the argument type(s), and return type(s) can be added to the function signature. Here is an example of a function that has had this done already:

def wrap_text_to_pixels(
    string: str, max_width: int, font=None, indent0: str = "", indent1: str = ""
) -> List[str]:

If you are new to Git or Github we have a guide about contributing to our projects here: https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github

There is also a guide that covers our CI utilities and how to run them locally to ensure they will pass in Github Actions here: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/check-your-code In particular the pages: Sharing docs on ReadTheDocs and Check your code with pre-commit contain the tools to install and commands to run locally to run the checks.

If you are attempting to resolve this issue and need help, you can post a comment on this issue and tag both @FoamyGuy and @kattni or reach out to us on Discord: https://adafru.it/discord in the #circuitpython-dev channel.

The following locations are reported by mypy to be missing type annotations:

  • adafruit_led_animation/__init__.py:15
  • adafruit_led_animation/color.py:77
  • adafruit_led_animation/animation/__init__.py:42
  • adafruit_led_animation/animation/__init__.py:66
  • adafruit_led_animation/animation/__init__.py:129
  • adafruit_led_animation/animation/__init__.py:152
  • adafruit_led_animation/animation/__init__.py:167
  • adafruit_led_animation/animation/__init__.py:174
  • adafruit_led_animation/animation/__init__.py:189
  • adafruit_led_animation/animation/__init__.py:203
  • adafruit_led_animation/sequence.py:77
  • adafruit_led_animation/sequence.py:131
  • adafruit_led_animation/sequence.py:135
  • adafruit_led_animation/sequence.py:162
  • adafruit_led_animation/sequence.py:188
  • adafruit_led_animation/sequence.py:214
  • adafruit_led_animation/sequence.py:218
  • adafruit_led_animation/sequence.py:291
  • adafruit_led_animation/sequence.py:301
  • adafruit_led_animation/helper.py:107
  • adafruit_led_animation/helper.py:127
  • adafruit_led_animation/helper.py:131
  • adafruit_led_animation/helper.py:147
  • adafruit_led_animation/helper.py:170
  • adafruit_led_animation/helper.py:174
  • adafruit_led_animation/helper.py:198
  • adafruit_led_animation/helper.py:202
  • adafruit_led_animation/helper.py:229
  • adafruit_led_animation/helper.py:255
  • adafruit_led_animation/helper.py:264
  • adafruit_led_animation/helper.py:272
  • adafruit_led_animation/helper.py:281
  • adafruit_led_animation/helper.py:310
  • adafruit_led_animation/group.py:87
  • adafruit_led_animation/group.py:112
  • adafruit_led_animation/group.py:126
  • adafruit_led_animation/group.py:135
  • adafruit_led_animation/group.py:165
  • adafruit_led_animation/group.py:169
  • adafruit_led_animation/animation/sparkle.py:46
  • adafruit_led_animation/animation/sparkle.py:57
  • adafruit_led_animation/animation/rainbow.py:50
  • adafruit_led_animation/animation/rainbow.py:102
  • adafruit_led_animation/animation/grid_rain.py:50
  • adafruit_led_animation/animation/grid_rain.py:86
  • adafruit_led_animation/animation/grid_rain.py:95
  • adafruit_led_animation/animation/grid_rain.py:100
  • adafruit_led_animation/animation/grid_rain.py:113
  • adafruit_led_animation/animation/grid_rain.py:125
  • adafruit_led_animation/animation/comet.py:49
  • adafruit_led_animation/animation/comet.py:84
  • adafruit_led_animation/animation/colorcycle.py:43
  • adafruit_led_animation/animation/chase.py:47
  • adafruit_led_animation/animation/chase.py:78
  • adafruit_led_animation/animation/chase.py:105
  • adafruit_led_animation/animation/chase.py:114
  • adafruit_led_animation/grid.py:71
  • adafruit_led_animation/grid.py:124
  • adafruit_led_animation/grid.py:136
  • adafruit_led_animation/grid.py:156
  • adafruit_led_animation/grid.py:160
  • adafruit_led_animation/grid.py:183
  • adafruit_led_animation/grid.py:187
  • adafruit_led_animation/grid.py:197
  • adafruit_led_animation/grid.py:203
  • adafruit_led_animation/grid.py:213
  • adafruit_led_animation/animation/sparklepulse.py:46
  • adafruit_led_animation/animation/sparklepulse.py:65
  • adafruit_led_animation/animation/solid.py:40
  • adafruit_led_animation/animation/solid.py:43
  • adafruit_led_animation/animation/rainbowsparkle.py:49
  • adafruit_led_animation/animation/rainbowcomet.py:50
  • adafruit_led_animation/animation/rainbowcomet.py:71
  • adafruit_led_animation/animation/rainbowchase.py:47
  • adafruit_led_animation/animation/rainbowchase.py:62