Skip to content

Commit d5853ba

Browse files
author
Joel Collins
committed
Fixed comments
1 parent d467463 commit d5853ba

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

examples/simple_thing.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,17 @@ def average_data(self, n: int):
7272
"""
7373

7474

75-
# Define the data we're going to output (get), and what to expect in (post)
75+
# Wrap in a semantic annotation to autmatically set schema and args
7676
@semantics.moz.LevelProperty(100, 500, example=200)
7777
class DenoiseProperty(PropertyView):
7878
"""Value of magic_denoise"""
7979

80-
# Main function to handle GET requests (read)
8180
def get(self):
82-
"""Show the current magic_denoise value"""
83-
8481
# When a GET request is made, we'll find our attached component
8582
my_component = find_component("org.labthings.example.mycomponent")
8683
return my_component.magic_denoise
8784

88-
# Main function to handle PUT requests (write)
8985
def put(self, new_property_value):
90-
"""Change the current magic_denoise value"""
91-
9286
# Find our attached component
9387
my_component = find_component("org.labthings.example.mycomponent")
9488

@@ -104,12 +98,12 @@ def put(self, new_property_value):
10498

10599

106100
class QuickDataProperty(PropertyView):
101+
"""Show the current data value"""
102+
103+
# Marshal the response as a list of floats
107104
schema = fields.List(fields.Float())
108105

109-
# Main function to handle GET requests
110106
def get(self):
111-
"""Show the current data value"""
112-
113107
# Find our attached component
114108
my_component = find_component("org.labthings.example.mycomponent")
115109
return my_component.data
@@ -128,7 +122,7 @@ class MeasurementAction(ActionView):
128122
missing=20, example=20, description="Number of data sets to average over",
129123
)
130124
}
131-
125+
# Marshal the response as a list of numbers
132126
schema = fields.List(fields.Number)
133127

134128
# Main function to handle POST requests

0 commit comments

Comments
 (0)