Skip to content

Commit 78ac575

Browse files
authored
Improved docstrings
1 parent 76831e2 commit 78ac575

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

examples/builder.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,25 @@
2626
my_component = PdfComponent()
2727
labthing.add_component(my_component, "org.labthings.example.mycomponent")
2828

29-
# Add routes for the API views we created
29+
# Make some properties and actions out of our component
3030

3131
labthing.build_property(
32-
my_component, "magic_denoise", "/denoise", description="A magic denoise property",
32+
my_component, # Python object
33+
"magic_denoise", # Objects attribute name
34+
"/denoise", # URL to bind the property to
35+
description="A magic denoise property",
3336
)
3437

3538
labthing.build_property(
36-
my_component,
37-
"magic_dictionary",
38-
"/dictionary",
39+
my_component, # Python object
40+
"magic_dictionary", # Objects attribute name
41+
"/dictionary", # URL to bind the property to
3942
description="A big dictionary of little properties",
4043
)
4144

4245
labthing.build_action(
43-
my_component.average_data,
44-
"/average",
46+
my_component.average_data, # Python function
47+
"/average", # URL to bind the action to
4548
description="Take an averaged measurement",
4649
safe=True, # Is the state of the Thing unchanged by calling the action?
4750
idempotent=True, # Can the action be called repeatedly with the same result?
@@ -51,9 +54,4 @@
5154
# Start the app
5255
if __name__ == "__main__":
5356
from labthings.server.wsgi import Server
54-
55-
logger = logging.getLogger()
56-
logger.setLevel(logging.DEBUG)
57-
58-
server = Server(app)
59-
server.run()
57+
Server(app).run()

0 commit comments

Comments
 (0)