File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 55import queue
66import logging
77import sys
8- from typing import Callable , List , Annotated
8+ from typing import Callable , List , Optional
99from enum import Enum
1010import requests
1111
@@ -29,14 +29,25 @@ def __init__(self):
2929 self .schedule_event : Callable [[VolEvents ]]
3030 """Event scheduler function provided by VolumeSynchronizer, has limited valid inputs that can be seen in the VolEvents enum"""
3131
32- self .volume : Annotated [ float | None , "float 0 <= value <= 1 or None" ] = None
32+ self ._volume : float = None
3333 """Value between 0 and 1, or None if not yet initialized by the upstream"""
3434
3535 self .logger : logging .Logger
3636 """logging.Logger instance provided by VolumeSynchronizer,"""
3737
3838 self .thread : threading .Thread = threading .Thread (target = self .run_async_watch , daemon = True ).start ()
3939
40+ @property
41+ def volume (self ) -> Optional [float ]:
42+ """Value between 0 and 1, or None if not yet initialized by the upstream"""
43+ return self ._volume
44+
45+ @volume .setter
46+ def volume (self , value : float ) -> None :
47+ if 0 > value or value > 1 :
48+ raise ValueError ("Volume must be between 0 and 1" )
49+ self ._volume = value
50+
4051 def run_async_watch (self ):
4152 """Middleman function for creating an asyncio run inside of a new threading.Thread"""
4253 asyncio .run (self .watch_vol ())
You can’t perform that action at this time.
0 commit comments