66
77import weakref
88from dataclasses import dataclass
9- from typing import TYPE_CHECKING , List , Tuple , Union
9+ from typing import TYPE_CHECKING , Union
1010from warnings import warn
1111
1212if TYPE_CHECKING :
@@ -33,22 +33,22 @@ def _process_define_macro_inner(formatted_options, macro):
3333 return True
3434 if isinstance (macro , tuple ):
3535 if len (macro ) != 2 or any (not isinstance (val , str ) for val in macro ):
36- raise RuntimeError (f"Expected define_macro Tuple [str, str], got { macro } " )
36+ raise RuntimeError (f"Expected define_macro tuple [str, str], got { macro } " )
3737 formatted_options .append (f"--define-macro={ macro [0 ]} ={ macro [1 ]} " )
3838 return True
3939 return False
4040
4141
4242def _process_define_macro (formatted_options , macro ):
43- union_type = "Union[str, Tuple [str, str]]"
43+ union_type = "Union[str, tuple [str, str]]"
4444 if _process_define_macro_inner (formatted_options , macro ):
4545 return
4646 if is_nested_sequence (macro ):
4747 for seq_macro in macro :
4848 if not _process_define_macro_inner (formatted_options , seq_macro ):
4949 raise RuntimeError (f"Expected define_macro { union_type } , got { seq_macro } " )
5050 return
51- raise RuntimeError (f"Expected define_macro { union_type } , List [{ union_type } ], got { macro } " )
51+ raise RuntimeError (f"Expected define_macro { union_type } , list [{ union_type } ], got { macro } " )
5252
5353
5454@dataclass
@@ -79,7 +79,7 @@ class ProgramOptions:
7979 Enable device code optimization. When specified along with ‘-G’, enables limited debug information generation
8080 for optimized device code.
8181 Default: None
82- ptxas_options : Union[str, List [str]], optional
82+ ptxas_options : Union[str, list [str]], optional
8383 Specify one or more options directly to ptxas, the PTX optimizing assembler. Options should be strings.
8484 For example ["-v", "-O2"].
8585 Default: None
@@ -113,17 +113,17 @@ class ProgramOptions:
113113 gen_opt_lto : bool, optional
114114 Run the optimizer passes before generating the LTO IR.
115115 Default: False
116- define_macro : Union[str, Tuple [str, str], List [Union[str, Tuple [str, str]]]], optional
116+ define_macro : Union[str, tuple [str, str], list [Union[str, tuple [str, str]]]], optional
117117 Predefine a macro. Can be either a string, in which case that macro will be set to 1, a 2 element tuple of
118118 strings, in which case the first element is defined as the second, or a list of strings or tuples.
119119 Default: None
120- undefine_macro : Union[str, List [str]], optional
120+ undefine_macro : Union[str, list [str]], optional
121121 Cancel any previous definition of a macro, or list of macros.
122122 Default: None
123- include_path : Union[str, List [str]], optional
123+ include_path : Union[str, list [str]], optional
124124 Add the directory or directories to the list of directories to be searched for headers.
125125 Default: None
126- pre_include : Union[str, List [str]], optional
126+ pre_include : Union[str, list [str]], optional
127127 Preinclude one or more headers during preprocessing. Can be either a string or a list of strings.
128128 Default: None
129129 no_source_include : bool, optional
@@ -156,13 +156,13 @@ class ProgramOptions:
156156 no_display_error_number : bool, optional
157157 Disable the display of a diagnostic number for warning messages.
158158 Default: False
159- diag_error : Union[int, List [int]], optional
159+ diag_error : Union[int, list [int]], optional
160160 Emit error for a specified diagnostic message number or comma separated list of numbers.
161161 Default: None
162- diag_suppress : Union[int, List [int]], optional
162+ diag_suppress : Union[int, list [int]], optional
163163 Suppress a specified diagnostic message number or comma separated list of numbers.
164164 Default: None
165- diag_warn : Union[int, List [int]], optional
165+ diag_warn : Union[int, list [int]], optional
166166 Emit warning for a specified diagnostic message number or comma separated lis of numbers.
167167 Default: None
168168 brief_diagnostics : bool, optional
@@ -189,7 +189,7 @@ class ProgramOptions:
189189 debug : bool | None = None
190190 lineinfo : bool | None = None
191191 device_code_optimize : bool | None = None
192- ptxas_options : Union [str , List [str ], Tuple [str ]] | None = None
192+ ptxas_options : Union [str , list [str ], tuple [str ]] | None = None
193193 max_register_count : int | None = None
194194 ftz : bool | None = None
195195 prec_sqrt : bool | None = None
@@ -200,11 +200,11 @@ class ProgramOptions:
200200 link_time_optimization : bool | None = None
201201 gen_opt_lto : bool | None = None
202202 define_macro : (
203- Union [str , Tuple [str , str ], List [Union [str , Tuple [str , str ]]], Tuple [Union [str , Tuple [str , str ]]]] | None
203+ Union [str , tuple [str , str ], list [Union [str , tuple [str , str ]]], tuple [Union [str , tuple [str , str ]]]] | None
204204 ) = None
205- undefine_macro : Union [str , List [str ], Tuple [str ]] | None = None
206- include_path : Union [str , List [str ], Tuple [str ]] | None = None
207- pre_include : Union [str , List [str ], Tuple [str ]] | None = None
205+ undefine_macro : Union [str , list [str ], tuple [str ]] | None = None
206+ include_path : Union [str , list [str ], tuple [str ]] | None = None
207+ pre_include : Union [str , list [str ], tuple [str ]] | None = None
208208 no_source_include : bool | None = None
209209 std : str | None = None
210210 builtin_move_forward : bool | None = None
@@ -215,9 +215,9 @@ class ProgramOptions:
215215 device_int128 : bool | None = None
216216 optimization_info : str | None = None
217217 no_display_error_number : bool | None = None
218- diag_error : Union [int , List [int ], Tuple [int ]] | None = None
219- diag_suppress : Union [int , List [int ], Tuple [int ]] | None = None
220- diag_warn : Union [int , List [int ], Tuple [int ]] | None = None
218+ diag_error : Union [int , list [int ], tuple [int ]] | None = None
219+ diag_suppress : Union [int , list [int ], tuple [int ]] | None = None
220+ diag_warn : Union [int , list [int ], tuple [int ]] | None = None
221221 brief_diagnostics : bool | None = None
222222 time : str | None = None
223223 split_compile : int | None = None
@@ -453,7 +453,7 @@ def compile(self, target_type, name_expressions=(), logs=None):
453453 target_type : Any
454454 String of the targeted compilation type.
455455 Supported options are "ptx", "cubin" and "ltoir".
456- name_expressions : Union[List, Tuple ], optional
456+ name_expressions : Union[list, tuple ], optional
457457 List of explicit name expressions to become accessible.
458458 (Default to no expressions)
459459 logs : Any, optional
0 commit comments