16
16
17
17
import attr
18
18
19
+ from .descriptorcollection import DescriptorCollection
19
20
from .descriptors import (
20
21
AccessFlags ,
21
22
ActionDescriptor ,
@@ -34,7 +35,7 @@ class _StatusMeta(type):
34
35
def __new__ (metacls , name , bases , namespace , ** kwargs ):
35
36
cls = super ().__new__ (metacls , name , bases , namespace )
36
37
37
- cls ._descriptors : Dict [ str , PropertyDescriptor ] = {}
38
+ cls ._descriptors : DescriptorCollection [ PropertyDescriptor ] = {}
38
39
cls ._parent : Optional ["DeviceStatus" ] = None
39
40
cls ._embedded : Dict [str , "DeviceStatus" ] = {}
40
41
@@ -86,7 +87,7 @@ def __repr__(self):
86
87
s += ">"
87
88
return s
88
89
89
- def descriptors (self ) -> Dict [ str , PropertyDescriptor ]:
90
+ def descriptors (self ) -> DescriptorCollection [ PropertyDescriptor ]:
90
91
"""Return the dict of sensors exposed by the status container.
91
92
92
93
Use @sensor and @setting decorators to define properties.
@@ -105,8 +106,8 @@ def embed(self, name: str, other: "DeviceStatus"):
105
106
self ._embedded [name ] = other
106
107
other ._parent = self # type: ignore[attr-defined]
107
108
108
- for property_name , prop in other .descriptors ().items ():
109
- final_name = f"{ name } __{ property_name } "
109
+ for descriptor_name , prop in other .descriptors ().items ():
110
+ final_name = f"{ name } __{ descriptor_name } "
110
111
111
112
self ._descriptors [final_name ] = attr .evolve (
112
113
prop , status_attribute = final_name
0 commit comments