Skip to content

Commit b51eaf9

Browse files
committed
Fix private member access for pyright SLF001
1 parent d2f1381 commit b51eaf9

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

src/fastcs/attributes.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,17 @@ def allowed_values(self) -> list[str] | None:
131131
return self._allowed_values
132132

133133
async def process(self, value: T) -> None:
134-
if self._write_display_callback is not None:
135-
await self._write_display_callback(self._datatype.dtype(value))
136-
137134
await self.process_without_display_update(value)
135+
await self.update_display_without_process(value)
138136

139137
async def process_without_display_update(self, value: T) -> None:
140138
if self._process_callback is not None:
141139
await self._process_callback(self._datatype.dtype(value))
142140

141+
async def update_display_without_process(self, value: T) -> None:
142+
if self._write_display_callback is not None:
143+
await self._write_display_callback(self._datatype.dtype(value))
144+
143145
def set_process_callback(self, callback: AttrCallback[T] | None) -> None:
144146
self._process_callback = callback
145147

src/fastcs/backends/epics/ioc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _get_input_record(pv_name: str, datatype: DataType) -> RecordWrapper:
3333

3434

3535
def _create_and_link_read_pv(pv_name: str, attribute: AttrR) -> None:
36-
record = _get_input_record(pv_name, attribute._datatype)
36+
record = _get_input_record(pv_name, attribute.datatype)
3737

3838
async def async_wrapper(v):
3939
record.set(v)

src/fastcs/backends/tango/dsr.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def register_dev(dev_name: str, dev_class: str, dsr_instance: str) -> None:
211211
dsr_name = f"{dev_class}/{dsr_instance}"
212212
dev_info = DbDevInfo()
213213
dev_info.name = dev_name
214-
dev_info._class = dev_class
214+
dev_info._class = dev_class # noqa
215215
dev_info.server = dsr_name
216216

217217
db = Database()

src/fastcs/controller.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ def path(self) -> list[str]:
1717
"""Path prefix of attributes, recursively including parent ``Controller``s."""
1818
return self._path
1919

20+
def set_path(self, path: list[str]):
21+
if self._path:
22+
raise ValueError(f"SubController is already registered under {self.path}")
23+
24+
self._path = path
25+
2026
def _bind_attrs(self) -> None:
2127
for attr_name in dir(self):
2228
attr = getattr(self, attr_name)
@@ -29,13 +35,9 @@ def register_sub_controller(self, name: str, sub_controller: SubController):
2935
raise ValueError(
3036
f"Controller {self} already has a SubController registered as {name}"
3137
)
32-
if sub_controller.path:
33-
raise ValueError(
34-
f"SubController is already registered under {sub_controller.path}"
35-
)
3638

3739
self.__sub_controller_tree[name] = sub_controller
38-
sub_controller._path = self.path + [name]
40+
sub_controller.set_path(self.path + [name])
3941

4042
def get_sub_controllers(self) -> dict[str, BaseController]:
4143
return self.__sub_controller_tree

0 commit comments

Comments
 (0)