File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 11import time
2- from labthings_fastapi .thing import Thing
3- from labthings_fastapi .decorators import thing_action
4- from labthings_fastapi .descriptors import ThingProperty
2+ import labthings_fastapi as lt
53
64
7- class TestThing (Thing ):
5+ class TestThing (lt . Thing ):
86 """A test thing with a counter property and a couple of actions"""
97
10- @thing_action
8+ @lt . thing_action
119 def increment_counter (self ) -> None :
1210 """Increment the counter property
1311
@@ -17,23 +15,22 @@ def increment_counter(self) -> None:
1715 """
1816 self .counter += 1
1917
20- @thing_action
18+ @lt . thing_action
2119 def slowly_increase_counter (self ) -> None :
2220 """Increment the counter slowly over a minute"""
2321 for i in range (60 ):
2422 time .sleep (1 )
2523 self .increment_counter ()
2624
27- counter = ThingProperty (
25+ counter = lt . ThingProperty (
2826 model = int , initial_value = 0 , readonly = True , description = "A pointless counter"
2927 )
3028
3129
3230if __name__ == "__main__" :
33- from labthings_fastapi .server import ThingServer
3431 import uvicorn
3532
36- server = ThingServer ()
33+ server = lt . ThingServer ()
3734
3835 # The line below creates a TestThing instance and adds it to the server
3936 server .add_thing (TestThing (), "/counter/" )
You can’t perform that action at this time.
0 commit comments