adafruit / adafruit/Adafruit_CircuitPython_LED_Animation

Missing Type Annotations

オープン
#83 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
documentation Hacktoberfest
主要言語
Python
スター
62
フォーク
46
PR マージ指標
30日以内にマージされた PR はありません

説明

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:

```python
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:

```python
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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

adafruit_led_animation/ にある一覧の mypy 箇所から始め、特に __init__.py、color.py、sequence.py、helper.py、group.py、grid.py、およびアニメーションモジュールを確認します。既存の wrap_text_to_pixels の例と、CircuitPython で安全な typing のインポートパターンを確認してから、文書化されている CI および mypy のチェックを実行します。一覧にある不足したアノテーションすべてに対応し、チェックに合格すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
embedded-iot
issue の種類
リファクタリング
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。