File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed
Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff 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 } )"
Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff line change 33
44
55def 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+ )
You can’t perform that action at this time.
0 commit comments