1717import os
1818import pathlib
1919import tempfile
20- from typing import Generator , List , Tuple
2120
2221
23- def package_name_from_interface_file_path (path : pathlib . Path ) -> str :
22+ def package_name_from_interface_file_path (path ) :
2423 """
2524 Derive ROS package name from a ROS interface definition file path.
2625
@@ -30,7 +29,7 @@ def package_name_from_interface_file_path(path: pathlib.Path) -> str:
3029 return pathlib .Path (os .path .abspath (path )).parents [1 ].name
3130
3231
33- def dependencies_from_include_paths (include_paths : List [ str ]) -> List [ str ] :
32+ def dependencies_from_include_paths (include_paths ) :
3433 """
3534 Collect dependencies' ROS interface definition files from include paths.
3635
@@ -46,7 +45,7 @@ def dependencies_from_include_paths(include_paths: List[str]) -> List[str]:
4645 })
4746
4847
49- def interface_path_as_tuple (path : str ) -> Tuple [ pathlib . Path , pathlib . Path ] :
48+ def interface_path_as_tuple (path ) :
5049 """
5150 Express interface definition file path as an (absolute prefix, relative path) tuple.
5251
@@ -62,43 +61,41 @@ def interface_path_as_tuple(path: str) -> Tuple[pathlib.Path, pathlib.Path]:
6261 """
6362 path_as_string = str (path )
6463 if ':' not in path_as_string :
65- prefix_path = pathlib .Path .cwd ()
64+ prefix = pathlib .Path .cwd ()
6665 else :
6766 prefix , _ , path = path_as_string .rpartition (':' )
68- prefix_path = pathlib .Path (os .path .abspath (prefix ))
69- path_as_path = pathlib .Path (path )
70- if path_as_path .is_absolute ():
67+ prefix = pathlib .Path (os .path .abspath (prefix ))
68+ path = pathlib .Path (path )
69+ if path .is_absolute ():
7170 raise ValueError ('Interface definition file path '
72- f"'{ path_as_path } ' cannot be absolute" )
73- return prefix_path , path_as_path
71+ f"'{ path } ' cannot be absolute" )
72+ return prefix , path
7473
7574
76- def idl_tuples_from_interface_files (
77- interface_files : List [str ]
78- ) -> List [str ]:
75+ def idl_tuples_from_interface_files (interface_files ):
7976 """
8077 Express ROS interface definition file paths as IDL tuples.
8178
8279 An IDL tuple is a relative path prefixed by an absolute path against
8380 which to resolve it followed by a colon ':'. This function then applies
8481 the same logic as `interface_path_as_tuple`.
8582 """
86- idl_tuples : List [ str ] = []
87- for interface_path in interface_files :
88- prefix , path = interface_path_as_tuple (interface_path )
83+ idl_tuples = []
84+ for path in interface_files :
85+ prefix , path = interface_path_as_tuple (path )
8986 idl_tuples .append (f'{ prefix } :{ path .as_posix ()} ' )
9087 return idl_tuples
9188
9289
9390@contextlib .contextmanager
9491def legacy_generator_arguments_file (
9592 * ,
96- package_name : str ,
97- interface_files : List [ str ] ,
98- include_paths : List [ str ] ,
99- templates_path : str ,
100- output_path : str
101- ) -> Generator [ str , None , None ] :
93+ package_name ,
94+ interface_files ,
95+ include_paths ,
96+ templates_path ,
97+ output_path
98+ ):
10299 """
103100 Generate a temporary rosidl generator arguments file.
104101
@@ -141,10 +138,10 @@ def legacy_generator_arguments_file(
141138
142139def generate_visibility_control_file (
143140 * ,
144- package_name : str ,
145- template_path : str ,
146- output_path : str
147- ) -> None :
141+ package_name ,
142+ template_path ,
143+ output_path
144+ ):
148145 """
149146 Generate a visibility control file from a template.
150147
0 commit comments