3333
3434import importlib
3535from threading import Lock
36- from typing import Any
36+ from typing import Any , Dict , Tuple
3737
3838""" ros_loader contains methods for dynamically loading ROS message classes at
3939runtime. It's achieved by using roslib to load the manifest files for the
@@ -129,7 +129,7 @@ def get_action_result_instance(typestring: str) -> Any:
129129
130130
131131def _get_interface_class (
132- typestring : str , intf_type : str , loaded_intfs : dict [str , Any ], intf_lock : Lock
132+ typestring : str , intf_type : str , loaded_intfs : Dict [str , Any ], intf_lock : Lock
133133) -> Any :
134134 """
135135 If not loaded, loads the specified ROS interface class then returns an instance of it.
@@ -152,7 +152,7 @@ def _get_interface_class(
152152 return _get_class (typestring , intf_type , loaded_intfs , intf_lock )
153153
154154
155- def _get_class (typestring : str , subname : str , cache : dict [str , Any ], lock : Lock ) -> Any :
155+ def _get_class (typestring : str , subname : str , cache : Dict [str , Any ], lock : Lock ) -> Any :
156156 """If not loaded, loads the specified class then returns an instance
157157 of it.
158158
@@ -206,7 +206,7 @@ def _load_class(modname: str, subname: str, classname: str) -> None:
206206 raise InvalidClassException (modname , subname , classname , exc )
207207
208208
209- def _splittype (typestring : str ) -> tuple [str , str ]:
209+ def _splittype (typestring : str ) -> Tuple [str , str ]:
210210 """Split the string the / delimiter and strip out empty strings
211211
212212 Performs similar logic to roslib.names.package_resource_name but is a bit
@@ -220,13 +220,13 @@ def _splittype(typestring: str) -> tuple[str, str]:
220220 raise InvalidTypeStringException (typestring )
221221
222222
223- def _add_to_cache (cache : dict [str , Any ], lock : Lock , key : str , value : any ) -> None :
223+ def _add_to_cache (cache : Dict [str , Any ], lock : Lock , key : str , value : any ) -> None :
224224 lock .acquire ()
225225 cache [key ] = value
226226 lock .release ()
227227
228228
229- def _get_from_cache (cache : dict [str , Any ], lock : Lock , key : str ) -> Any :
229+ def _get_from_cache (cache : Dict [str , Any ], lock : Lock , key : str ) -> Any :
230230 """Returns the value for the specified key from the cache.
231231 Locks the lock before doing anything. Returns None if key not in cache"""
232232 lock .acquire ()
0 commit comments