Add getter/setter decorators
メンテナーはふだん 6 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 6
- フォーク
- 8
- 平均マージ
- 3日 22時間
- マージ済み PR(30日)
- 3
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DiamondLightSource/fastcs のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
DiamondLightSource/fastcs#443 ·
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
DiamondLightSource/fastcs#437 ·
メンテナーはふだん 6 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
DiamondLightSource/fastcs#416 ·
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
DiamondLightSource/fastcs#345 ·
メンテナーはふだん 6 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 62/100
DiamondLightSource/fastcs#341 ·
メンテナーはふだん 6 日以内に返信
DiamondLightSource/fastcs の issue をすべて見る
似ている issue
-
eegprep-lean: set channel types from the Zarr group's channel_type対応中かも @claude が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
blacklanternsecurity/bbot#3679 ·
メンテナーはふだん 2 日以内に返信
-
Link Checker ReportオープンBot Type: Bug Type: Documentation
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
speakeasy-api/speakeasy#2159 ·
メンテナーはふだん 1 日以内に返信