1010
1111"""
1212
13+ from __future__ import annotations
14+
1315from . import Attribute
1416from . import StructCharacteristic
1517
18+ try :
19+ from typing import Optional , Type , TYPE_CHECKING
20+
21+ if TYPE_CHECKING :
22+ from circuitpython_typing import ReadableBuffer
23+ from adafruit_ble .uuid import UUID
24+ from adafruit_ble .services import Service
25+
26+ except ImportError :
27+ pass
28+
1629__version__ = "0.0.0-auto.0"
1730__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_BLE.git"
1831
@@ -23,12 +36,12 @@ class FloatCharacteristic(StructCharacteristic):
2336 def __init__ (
2437 self ,
2538 * ,
26- uuid = None ,
27- properties = 0 ,
28- read_perm = Attribute .OPEN ,
29- write_perm = Attribute .OPEN ,
30- initial_value = None
31- ):
39+ uuid : Optional [ UUID ] = None ,
40+ properties : int = 0 ,
41+ read_perm : int = Attribute .OPEN ,
42+ write_perm : int = Attribute .OPEN ,
43+ initial_value : Optional [ ReadableBuffer ] = None ,
44+ ) -> None :
3245 if initial_value is not None :
3346 initial_value = (initial_value ,)
3447 super ().__init__ (
@@ -40,10 +53,12 @@ def __init__(
4053 initial_value = initial_value ,
4154 )
4255
43- def __get__ (self , obj , cls = None ):
56+ def __get__ (
57+ self , obj : Optional [Service ], cls : Optional [Type [Service ]] = None
58+ ) -> float :
4459 if obj is None :
4560 return self
4661 return super ().__get__ (obj )[0 ]
4762
48- def __set__ (self , obj , value ) :
63+ def __set__ (self , obj : Service , value : float ) -> None :
4964 super ().__set__ (obj , (value ,))
0 commit comments