Add getter/setter decorators
Maintainer thường phản hồi trong vòng 6 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 54/100
Hướng nghiên cứu
Read the getter/setter constructors from #466 and typed metadata work in #442, along with the migration decisions linked in the description. Trace how controller attributes are created and bound to each instance, then add coverage for bare and parameterised @attr, setter behavior, annotations, metadata, and polling defaults. Update the docs for the decorator form; done when the acceptance criteria pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
As part of migrating changes from #402 (see #388, decision 14, and #423), attributes should be declarable by decorating the controller method that reads them. Even with getters/setters (#466), the simplest case still needs the attribute wired up by hand in __init__. Using decorators, we can have:
class PowerSupply(Controller):
@attr(Polled(period=0.5), units="V")
async def voltage(self) -> float:
"""Output voltage."""
return float(await self._conn.query("V?"))
@voltage.setter
async def voltage(self, value: float) -> None:
await self._conn.send(f"V={value}")
which is shorthand built on the getter=/setter= constructors, and thus depends on that work being done.
Depends on #466 (getter/setter) and #442 (typed metadata keyword arguments).
Acceptance Criteria
-
@attr(bare or parameterised) on a getter creates anAttrR; adding
@x.settermakes it anAttrRW - The datatype comes from the getter's return annotation, and the description
from its docstring - Decorator keyword arguments are the attribute's metadata; an optional schedule
(Polled/NotPolled) controls polling, with the same defaults asgetter= - Each controller instance gets its own attribute, bound to that instance
- Docs cover the decorator form
- Ngôn ngữ chính
- Python
- Star
- 6
- Fork
- 8
- Merge trung bình
- 3 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DiamondLightSource/fastcs
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
DiamondLightSource/fastcs#443 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
DiamondLightSource/fastcs#437 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
DiamondLightSource/fastcs#416 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
DiamondLightSource/fastcs#345 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 62/100
DiamondLightSource/fastcs#341 ·
Maintainer thường phản hồi trong vòng 6 ngày
Tất cả issue của DiamondLightSource/fastcs
Issue tương tự
-
eegprep-lean: set channel types from the Zarr group's channel_typeCó thể đã có người làm @claude đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
sccn/eegprep#668 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Upgrade Django to 5.2.18Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
blacklanternsecurity/bbot#3679 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Link Checker ReportĐang mởBot Type: Bug Type: Documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
speakeasy-api/speakeasy#2159 ·
Maintainer thường phản hồi trong vòng 1 ngày