Add getter/setter decorators
Los mantenedores suelen responder en 6 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 54/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Python
- Estrellas
- 6
- Forks
- 8
- Merge medio
- 3 d 22 h
- PR fusionados (30 d)
- 3
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de DiamondLightSource/fastcs
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
DiamondLightSource/fastcs#443 ·
Los mantenedores suelen responder en 6 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
DiamondLightSource/fastcs#437 ·
Los mantenedores suelen responder en 6 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
DiamondLightSource/fastcs#416 ·
Los mantenedores suelen responder en 6 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
DiamondLightSource/fastcs#345 ·
Los mantenedores suelen responder en 6 días
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 62/100
DiamondLightSource/fastcs#341 ·
Los mantenedores suelen responder en 6 días
Todos los issues de DiamondLightSource/fastcs
Issues similares
-
eegprep-lean: set channel types from the Zarr group's channel_typePosiblemente ocupada @claude la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
sccn/eegprep#668 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Upgrade Django to 5.2.18Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
blacklanternsecurity/bbot#3679 ·
Los mantenedores suelen responder en 2 días
-
Link Checker ReportAbiertoBot Type: Bug Type: Documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
speakeasy-api/speakeasy#2159 ·
Los mantenedores suelen responder en 1 día