Skip to content

Commit 98fdd76

Browse files
committed
chore: fix typing due to integer in controller path
1 parent d6bfed5 commit 98fdd76

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/fastcs/attributes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def name(self) -> str:
7474
return self._name
7575

7676
@property
77-
def path(self) -> list[str]:
77+
def path(self) -> list[int | str]:
7878
return self._path
7979

8080
def add_update_datatype_callback(
@@ -99,7 +99,7 @@ def set_name(self, name: str):
9999

100100
self._name = name
101101

102-
def set_path(self, path: list[str]):
102+
def set_path(self, path: list[int | str]):
103103
if self._path:
104104
raise RuntimeError(
105105
f"Attribute is already registered with a controller at {self._path}"
@@ -109,7 +109,7 @@ def set_path(self, path: list[str]):
109109

110110
def __repr__(self):
111111
name = self.__class__.__name__
112-
path = ".".join(self._path + [self._name]) or None
112+
path = ".".join([str(node) for node in self._path] + [self._name]) or None
113113
datatype = self._datatype.__class__.__name__
114114

115115
return f"{name}(path={path}, datatype={datatype}, io_ref={self._io_ref})"

src/fastcs/controller_api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ def walk_api(self) -> Iterator["ControllerAPI"]:
3838
yield from api.walk_api()
3939

4040
def __repr__(self):
41-
return f"""\
42-
ControllerAPI(path={self.path}, sub_apis=[{", ".join(self.sub_apis.keys())}])\
43-
"""
41+
return (
42+
f"ControllerAPI("
43+
f"path={self.path}, "
44+
f"sub_apis=[{', '.join(str(sub_api) for sub_api in self.sub_apis.keys())}]"
45+
f")"
46+
)
4447

4548
def get_scan_and_initial_coros(
4649
self,

src/fastcs/transport/epics/util.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33

44

55
def controller_pv_prefix(prefix: str, controller_api: ControllerAPI) -> str:
6-
return ":".join([prefix] + [snake_to_pascal(node) for node in controller_api.path])
6+
return ":".join(
7+
[prefix] + [snake_to_pascal(str(node)) for node in controller_api.path]
8+
)

0 commit comments

Comments
 (0)