adafruit / adafruit/Adafruit_CircuitPython_LED_Animation

Missing Type Annotations

Đang mở
#83 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

documentation Hacktoberfest
Ngôn ngữ chính
Python
Star
62
Fork
46
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với các vị trí mypy được liệt kê trong adafruit_led_animation/, đặc biệt là init.py, color.py, sequence.py, helper.py, group.py, grid.py và các mô-đun animation. Xem lại ví dụ wrap_text_to_pixels hiện có và mẫu import typing an toàn cho CircuitPython, sau đó chạy các bước kiểm tra CI và mypy đã được tài liệu hóa. Hoàn thành có nghĩa là tất cả các annotation còn thiếu được liệt kê đều đã được bổ sung và các bước kiểm tra đều đạt.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
embedded-iot
Loại issue
Tái cấu trúc
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.