Skip to content

Commit b023023

Browse files
committed
Add docstrings to the example Thing.
1 parent b3a8c6e commit b023023

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/source/tutorial/writing_a_thing.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ Our first Thing will pretend to be a light: we can set its brightness and turn i
1616
import labthings_fastapi as lt
1717
1818
class Light(lt.Thing):
19+
"""A computer-controlled light, our first example Thing."""
20+
1921
brightness: int = lt.property(default=100)
22+
"""The brightness of the light, in % of maximum."""
23+
2024
is_on: bool = lt.property(default=False, readonly=true)
25+
"""Whether the light is currently on."""
2126
2227
@lt.action
2328
def toggle(self):
29+
"""Swap the light between on and off."""
2430
self.is_on = not self.is_on
2531
2632

0 commit comments

Comments
 (0)