Add getter/setter decorators
I maintainer di solito rispondono entro 6 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 54/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 6
- Fork
- 8
- Merge medio
- 3g 22h
- PR unite (30g)
- 3
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di DiamondLightSource/fastcs
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
DiamondLightSource/fastcs#443 ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
DiamondLightSource/fastcs#437 ·
I maintainer di solito rispondono entro 6 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
DiamondLightSource/fastcs#416 ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
DiamondLightSource/fastcs#345 ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 62/100
DiamondLightSource/fastcs#341 ·
I maintainer di solito rispondono entro 6 giorni
Tutte le issue di DiamondLightSource/fastcs
Issue simili
-
eegprep-lean: set channel types from the Zarr group's channel_typeForse già presa @claude l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
sccn/eegprep#668 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Upgrade Django to 5.2.18Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
blacklanternsecurity/bbot#3679 ·
I maintainer di solito rispondono entro 2 giorni
-
Link Checker ReportApertaBot Type: Bug Type: Documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
speakeasy-api/speakeasy#2159 ·
I maintainer di solito rispondono entro 1 giorno