Replace IO and IORefs with getters/setters
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ó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Start by reading the existing AttributeIO and AttributeIORef implementations and controller attribute APIs; this issue does not name their file paths or tests. Review the linked prerequisite issue #442 and trace how attributes are read, written, polled, and mirrored to transports. Done means replacing IO and IORef usage with per attribute getters and setters and meeting the acceptance criteria.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
IOs and IORefs make writing simple controllers verbose:
@dataclass
class HelloIORef(AttributeIORef):
key: str
_: KW_ONLY
update_period: float | None = 0.5
class HelloIO(AttributeIO[Any, HelloIORef]):
def __init__(self, device): super().__init__(); self._device = device
async def update(self, attr):
await attr.update(await self._device.get(attr.io_ref.key))
async def send(self, attr, value):
await self._device.set(attr.io_ref.key, value)
class HelloController(Controller):
message = AttrR(String(), io_ref=HelloIORef("message"))
def __init__(self):
self._device = HelloDevice()
super().__init__(ios=[HelloIO(self._device)])
We should replace AttributeIO/AttributeIORef with per-attribute getter/setter callables:
class HelloController(Controller):
def __init__(self, device):
self._device = device
super().__init__()
self.message = AttrRW(
String(), # optional: would be inferred from `-> str`
getter=Polled(self._get_message, period=1.0),
setter=self._set_message,
)
async def _get_message(self) -> str:
return await self._device.get("message")
async def _set_message(self, message: str) -> None:
await self._device.set("message", message)
- Scheduling: bare getter → read once on connect;
Polled(fn, period=...)→ polled;
NotPolled(fn)→ only onawait attr.poll() - Datatype inferred from getter return / setter parameter (int, float, bool, str, Enum)
- Getters/setters may return
Update(readback, setpoint=...); a setter's bare return
value is the device-accepted value - Attribute owns the setpoint; all transports mirror it via
add_setpoint_callback
(removes per-transport seeding)
Breaking changes
ios=removed from controllers;AttributeIO,AttributeIORefremovedAttribute[T, Ref]→Attribute[T], as no reference requiredget()→.readback,put()→set(), callback renames, removed methods (list)update_period=Nonerefs should migrate toNotPolled
Depends on https://github.com/DiamondLightSource/fastcs/issues/442.
Acceptance Criteria
- IOs and IORefs are replaced with getter/setter
- 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