@@ -17,6 +17,7 @@ class BaseController(Tracer):
1717
1818 #: Attributes passed from the device at runtime.
1919 attributes : dict [str , Attribute ]
20+ root_attribute : Attribute | None = None
2021
2122 description : str | None = None
2223
@@ -144,9 +145,7 @@ def add_attribute(self, name, attribute: Attribute):
144145 self .attributes [name ] = attribute
145146 super ().__setattr__ (name , attribute )
146147
147- def add_sub_controller (
148- self , name : str , sub_controller : Controller | ControllerVector
149- ):
148+ def add_sub_controller (self , name : str , sub_controller : BaseController ):
150149 if name in self .__sub_controller_tree .keys ():
151150 raise ValueError (
152151 f"Cannot add sub controller { sub_controller } . "
@@ -196,18 +195,14 @@ class Controller(BaseController):
196195 such as generating a UI or creating parameters for a control system.
197196 """
198197
199- root_attribute : Attribute | None = None
200-
201198 def __init__ (
202199 self ,
203200 description : str | None = None ,
204201 ios : Sequence [AttributeIO [T , AttributeIORefT ]] | None = None ,
205202 ) -> None :
206203 super ().__init__ (description = description , ios = ios )
207204
208- def add_sub_controller (
209- self , name : str , sub_controller : Controller | ControllerVector
210- ):
205+ def add_sub_controller (self , name : str , sub_controller : BaseController ):
211206 if name .isdigit ():
212207 raise ValueError (
213208 f"Cannot add sub controller { name } . "
@@ -226,8 +221,6 @@ class ControllerVector(MutableMapping[int, Controller], BaseController):
226221 """A controller with a collection of identical sub controllers distinguished
227222 by a numeric value"""
228223
229- root_attribute : Attribute | None = None
230-
231224 def __init__ (
232225 self ,
233226 children : Mapping [int , Controller ],
@@ -239,9 +232,7 @@ def __init__(
239232 for index , child in children .items ():
240233 self [index ] = child
241234
242- def add_sub_controller (
243- self , name : str , sub_controller : Controller | ControllerVector
244- ):
235+ def add_sub_controller (self , name : str , sub_controller : BaseController ):
245236 raise NotImplementedError (
246237 "Cannot add named sub controller to ControllerVector. "
247238 "Use __setitem__ instead, for indexed sub controllers. "
0 commit comments