2727from tango .asyncio import DeviceProxy as AsyncDeviceProxy
2828
2929from ._tango_transport import TangoSignalBackend , get_python_type
30+ from ._utils import get_device_trl_and_attr
3031
3132logger = logging .getLogger ("ophyd_async" )
3233
@@ -35,16 +36,14 @@ def make_backend(
3536 datatype : type [SignalDatatypeT ] | None ,
3637 read_trl : str = "" ,
3738 write_trl : str = "" ,
38- device_proxy : DeviceProxy | None = None ,
3939) -> TangoSignalBackend :
40- return TangoSignalBackend (datatype , read_trl , write_trl , device_proxy )
40+ return TangoSignalBackend (datatype , read_trl , write_trl )
4141
4242
4343def tango_signal_rw (
4444 datatype : type [SignalDatatypeT ],
4545 read_trl : str ,
4646 write_trl : str = "" ,
47- device_proxy : DeviceProxy | None = None ,
4847 timeout : float = DEFAULT_TIMEOUT ,
4948 name : str = "" ,
5049) -> SignalRW [SignalDatatypeT ]:
@@ -58,22 +57,19 @@ def tango_signal_rw(
5857 The Attribute/Command to read and monitor
5958 write_trl:
6059 If given, use this Attribute/Command to write to, otherwise use read_trl
61- device_proxy:
62- If given, this DeviceProxy will be used
6360 timeout:
6461 The timeout for the read and write operations
6562 name:
6663 The name of the Signal
6764
6865 """
69- backend = make_backend (datatype , read_trl , write_trl or read_trl , device_proxy )
66+ backend = make_backend (datatype , read_trl , write_trl or read_trl )
7067 return SignalRW (backend , timeout = timeout , name = name )
7168
7269
7370def tango_signal_r (
7471 datatype : type [SignalDatatypeT ],
7572 read_trl : str ,
76- device_proxy : DeviceProxy | None = None ,
7773 timeout : float = DEFAULT_TIMEOUT ,
7874 name : str = "" ,
7975) -> SignalR [SignalDatatypeT ]:
@@ -85,22 +81,19 @@ def tango_signal_r(
8581 Check that the Attribute/Command is of this type
8682 read_trl:
8783 The Attribute/Command to read and monitor
88- device_proxy:
89- If given, this DeviceProxy will be used
9084 timeout:
9185 The timeout for the read operation
9286 name:
9387 The name of the Signal
9488
9589 """
96- backend = make_backend (datatype , read_trl , read_trl , device_proxy )
90+ backend = make_backend (datatype , read_trl , read_trl )
9791 return SignalR (backend , timeout = timeout , name = name )
9892
9993
10094def tango_signal_w (
10195 datatype : type [SignalDatatypeT ],
10296 write_trl : str ,
103- device_proxy : DeviceProxy | None = None ,
10497 timeout : float = DEFAULT_TIMEOUT ,
10598 name : str = "" ,
10699) -> SignalW [SignalDatatypeT ]:
@@ -112,21 +105,18 @@ def tango_signal_w(
112105 Check that the Attribute/Command is of this type
113106 write_trl:
114107 The Attribute/Command to write to
115- device_proxy:
116- If given, this DeviceProxy will be used
117108 timeout:
118109 The timeout for the write operation
119110 name:
120111 The name of the Signal
121112
122113 """
123- backend = make_backend (datatype , write_trl , write_trl , device_proxy )
114+ backend = make_backend (datatype , write_trl , write_trl )
124115 return SignalW (backend , timeout = timeout , name = name )
125116
126117
127118def tango_signal_x (
128119 write_trl : str ,
129- device_proxy : DeviceProxy | None = None ,
130120 timeout : float = DEFAULT_TIMEOUT ,
131121 name : str = "" ,
132122) -> SignalX :
@@ -136,15 +126,13 @@ def tango_signal_x(
136126 ----------
137127 write_trl:
138128 The Attribute/Command to write its initial value to on execute
139- device_proxy:
140- If given, this DeviceProxy will be used
141129 timeout:
142130 The timeout for the command operation
143131 name:
144132 The name of the Signal
145133
146134 """
147- backend = make_backend (None , write_trl , write_trl , device_proxy )
135+ backend = make_backend (None , write_trl , write_trl )
148136 return SignalX (backend , timeout = timeout , name = name )
149137
150138
@@ -153,7 +141,7 @@ async def infer_python_type(
153141) -> object | npt .NDArray | type [DevState ] | IntEnum :
154142 """Infers the python type from the TRL."""
155143 # TODO: work out if this is still needed
156- device_trl , tr_name = trl . rsplit ( "/" , 1 )
144+ device_trl , tr_name = get_device_trl_and_attr ( trl )
157145 if proxy is None :
158146 dev_proxy = await AsyncDeviceProxy (device_trl )
159147 else :
@@ -182,7 +170,7 @@ async def infer_python_type(
182170async def infer_signal_type (
183171 trl , proxy : DeviceProxy | None = None
184172) -> type [Signal ] | None :
185- device_trl , tr_name = trl . rsplit ( "/" , 1 )
173+ device_trl , tr_name = get_device_trl_and_attr ( trl )
186174 if proxy is None :
187175 dev_proxy = await AsyncDeviceProxy (device_trl )
188176 else :
0 commit comments