@@ -45,7 +45,7 @@ def replace_section(self, file_path, ifdef_guard, begin_marker, end_marker, new_
4545 with open (file_path , 'r' ) as file :
4646 content = file .read ()
4747
48- pattern = re .compile (f'{ begin_marker } .*?{ end_marker } ' , re .DOTALL )
48+ pattern = re .compile (f'{ re . escape ( begin_marker ) } .*?{ re . escape ( end_marker ) } ' , re .DOTALL )
4949 if not pattern .search (content ):
5050 ifdef_match = re .search (rf'{ re .escape (ifdef_guard )} (.*?)(?=#endif)' , content , re .DOTALL )
5151 if (ifdef_match ):
@@ -55,8 +55,8 @@ def replace_section(self, file_path, ifdef_guard, begin_marker, end_marker, new_
5555 else :
5656 raise ValueError (f"Cannot find { ifdef_guard } in { file_path } " )
5757
58- replacment = f'{ begin_marker } \n { new_content } \n { end_marker } '
59- content = pattern .sub (replacment , content )
58+ replacement = f'{ begin_marker } \n { new_content } \n { end_marker } '
59+ content = pattern .sub (replacement , content )
6060
6161 with open (file_path , 'w' ) as file :
6262 file .write (content )
@@ -68,7 +68,7 @@ def update_lookup_table(self, file_path, ifdef_guard, mapping):
6868 with open (file_path , 'r' ) as file :
6969 content = file .read ()
7070
71- pattern = re .compile (f'{ mapping } ' , re .DOTALL )
71+ pattern = re .compile (f'{ re . escape ( mapping ) } ' , re .DOTALL )
7272 if not pattern .search (content ):
7373 ifdef_match = re .search (rf'{ re .escape (ifdef_guard )} (.*?)(?=#endif)' , content , re .DOTALL )
7474 if (ifdef_match ):
@@ -373,7 +373,7 @@ def print_results(result):
373373def main (args = None ):
374374 """
375375 usage: quickTunerGen.py [-h] --input-dir INPUT_DIR --op {gemm,conv} [--th TH] --arch ARCH [--update] [--no-splitk]
376- usage exsample : python3 quickTuningGen.py --input-dir tunedData --op conv --arch gfx90a --update --no-splitk
376+ usage example : python3 quickTuningGen.py --input-dir tunedData --op conv --arch gfx90a --update --no-splitk
377377 """
378378 if args is None :
379379 args = sys .argv [1 :]
@@ -393,7 +393,7 @@ def main(args=None):
393393 parser .add_argument ('--no-splitk' ,
394394 default = False ,
395395 action = 'store_true' ,
396- help = 'Removing the Split-K factor from the generated list' )
396+ help = 'Remove the Split-K factor from the generated list' )
397397
398398 pargs = parser .parse_args ()
399399
0 commit comments