Skip to content

Commit b0056c7

Browse files
committed
chore: address review comments
1 parent 4b3e2e3 commit b0056c7

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

src/fastcs/controller.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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. "

src/fastcs/controller_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __repr__(self):
4141
return (
4242
f"ControllerAPI("
4343
f"path={self.path}, "
44-
f"sub_apis=[{', '.join(sub_api for sub_api in self.sub_apis.keys())}]"
44+
f"sub_apis=[{', '.join(self.sub_apis.keys())}]"
4545
f")"
4646
)
4747

src/fastcs/transport/epics/pva/pvi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ def _make_p4p_raw_value(pv_prefix: str, controller_api: ControllerAPI) -> dict:
7070
# Sub-controller api returned if current item is a Controller
7171
for pv_leaf, sub_controller_api in controller_api.sub_apis.items():
7272
# Add Controller entry
73-
# Sub-device of a ControllerVector
7473
pv = f"{pv_prefix}:{snake_to_pascal(pv_leaf)}:PVI"
7574
if sub_controller_api.path[-1].isdigit():
75+
# Sub-device of a ControllerVector
7676
p4p_raw_value[f"__{int(pv_leaf)}"]["d"] = pv
7777
else:
7878
p4p_raw_value[pv_leaf]["d"] = pv

0 commit comments

Comments
 (0)