77
88./generate_stubs.py path/to/clone/of/array-api
99
10- This will update the stub files in array_api_tests /function_stubs/
10+ This will update the stub files in xptests /function_stubs/
1111"""
1212from __future__ import annotations
1313
@@ -218,12 +218,12 @@ def main():
218218 parser .add_argument ('-v' , '--verbose' , help = "Print verbose output to the terminal" , action = 'store_true' )
219219 args = parser .parse_args ()
220220
221- types_path = os .path .join ('array_api_tests ' , 'function_stubs' , '_types.py' )
221+ types_path = os .path .join ('xptests ' , 'function_stubs' , '_types.py' )
222222 if args .write :
223223 with open (types_path , 'w' ) as f :
224224 f .write (TYPES_HEADER )
225225
226- special_cases_dir = Path ('array_api_tests /special_cases' )
226+ special_cases_dir = Path ('xptests /special_cases' )
227227 special_cases_dir .mkdir (exist_ok = True )
228228 (special_cases_dir / '__init__.py' ).touch ()
229229
@@ -256,7 +256,7 @@ def main():
256256 title += " (Extension)"
257257 else :
258258 py_file = filename .replace ('.md' , '.py' )
259- py_path = os .path .join ('array_api_tests ' , 'function_stubs' , py_file )
259+ py_path = os .path .join ('xptests ' , 'function_stubs' , py_file )
260260 module_name = py_file .replace ('.py' , '' )
261261 modules [module_name ] = []
262262 if args .verbose :
@@ -342,7 +342,7 @@ def {annotated_sig}:{doc}
342342 if filename == 'elementwise_functions.md' :
343343 special_cases = parse_special_cases (text , verbose = args .verbose )
344344 for func in special_cases :
345- py_path = os .path .join ('array_api_tests ' , 'special_cases' , f'test_{ func } .py' )
345+ py_path = os .path .join ('xptests ' , 'special_cases' , f'test_{ func } .py' )
346346 tests = make_special_case_tests (func , special_cases , sigs )
347347 if tests :
348348 code = SPECIAL_CASES_HEADER .format (func = func ) + '\n ' .join (tests )
@@ -354,7 +354,7 @@ def {annotated_sig}:{doc}
354354 elif filename == 'array_object.md' :
355355 op_special_cases = parse_special_cases (text , verbose = args .verbose )
356356 for func in op_special_cases :
357- py_path = os .path .join ('array_api_tests ' , 'special_cases' , f'test_dunder_{ func [2 :- 2 ]} .py' )
357+ py_path = os .path .join ('xptests ' , 'special_cases' , f'test_dunder_{ func [2 :- 2 ]} .py' )
358358 tests = make_special_case_tests (func , op_special_cases , sigs )
359359 if tests :
360360 code = OP_SPECIAL_CASES_HEADER .format (func = func ) + '\n ' .join (tests )
@@ -368,7 +368,7 @@ def {annotated_sig}:{doc}
368368 iop = f"__i{ name } __"
369369 iop_special_cases [iop ] = op_special_cases [op ]
370370 for func in iop_special_cases :
371- py_path = os .path .join ('array_api_tests ' , 'special_cases' , f'test_dunder_{ func [2 :- 2 ]} .py' )
371+ py_path = os .path .join ('xptests ' , 'special_cases' , f'test_dunder_{ func [2 :- 2 ]} .py' )
372372 tests = make_special_case_tests (func , iop_special_cases , sigs )
373373 if tests :
374374 code = IOP_SPECIAL_CASES_HEADER .format (func = func , operator = func [2 :- 2 ]) + '\n ' .join (tests )
@@ -377,7 +377,7 @@ def {annotated_sig}:{doc}
377377 with open (py_path , 'w' ) as f :
378378 f .write (code )
379379
380- init_path = os .path .join ('array_api_tests ' , 'function_stubs' , '__init__.py' )
380+ init_path = os .path .join ('xptests ' , 'function_stubs' , '__init__.py' )
381381 if args .write :
382382 with open (init_path , 'w' ) as f :
383383 f .write (INIT_HEADER )
0 commit comments