@@ -86,10 +86,10 @@ def suffix_greater(suffix1, suffix2):
8686 if suffix2 == "" :
8787 return True
8888 else :
89- m1 = re .match ("^(\d+)([a-z])?$" , suffix1 )
89+ m1 = re .match (r "^(\d+)([a-z])?$" , suffix1 )
9090 num1 = int (m1 .group (1 ))
9191 alpha1 = m1 .group (2 )
92- m2 = re .match ("^(\d+)([a-z])?$" , suffix2 )
92+ m2 = re .match (r "^(\d+)([a-z])?$" , suffix2 )
9393 num2 = int (m2 .group (1 ))
9494 alpha2 = m2 .group (2 )
9595 if num1 > num2 :
@@ -105,7 +105,7 @@ def suffix_greater(suffix1, suffix2):
105105def suffix_one_more_than (suffix1 , suffix2 ):
106106 if suffix1 == suffix2 :
107107 raise Exception (f"Identical suffixes { suffix1 } " )
108- m1 = re .match ("^(\d+)([a-z])?$" , suffix1 )
108+ m1 = re .match (r "^(\d+)([a-z])?$" , suffix1 )
109109 num1 = int (m1 .group (1 ))
110110 alpha1 = m1 .group (2 )
111111 if suffix2 == "" :
@@ -114,7 +114,7 @@ def suffix_one_more_than(suffix1, suffix2):
114114 else :
115115 return num1 == 1 and (alpha1 is None or alpha1 == "a" )
116116 else :
117- m2 = re .match ("^(\d+)([a-z])?$" , suffix2 )
117+ m2 = re .match (r "^(\d+)([a-z])?$" , suffix2 )
118118 num2 = int (m2 .group (1 ))
119119 alpha2 = m2 .group (2 )
120120 if num1 > num2 :
@@ -159,7 +159,7 @@ def type_to_short_type(t):
159159 # strip trailing comments
160160 line = re .sub (r"\s*//.*$" , "" , line )
161161 if line :
162- if m := re .match ("^\w+ ((\w+)2(\w+))\(([^\)]+)\);$" , line ):
162+ if m := re .match (r "^\w+ ((\w+)2(\w+))\(([^\)]+)\);$" , line ):
163163 conversion_function = m .group (1 )
164164 from_type = m .group (2 )
165165 to_type = m .group (3 )
@@ -188,7 +188,7 @@ def _check_test(filename, lineno, line, test_macro, function, num_input_args, co
188188 conversion_functions [function ].tested = True
189189 if num_input_args != conversion_functions [function ].num_input_args :
190190 raise Exception (f"{ filename } :{ lineno } { num_input_args } arguments were passed to { function } which only expects { conversion_functions [function ].num_input_args } arguments" )
191- function_group = re .sub ("_(\d+)$" , "_N" , function )
191+ function_group = re .sub (r "_(\d+)$" , "_N" , function )
192192 if function_group not in function_groups :
193193 raise Exception (f"{ filename } :{ lineno } Unexpected function group { function_group } " )
194194 else :
@@ -199,7 +199,7 @@ def _check_test(filename, lineno, line, test_macro, function, num_input_args, co
199199 if not test_name .startswith (expected_prefix ):
200200 raise Exception (f"{ filename } :{ lineno } { test_name } tests { function } , so expected it to start with { expected_prefix } " )
201201 if ENFORCE_UNDERSCORE_IN_SUFFIX_IF_FUNCTION_ENDS_WITH_NUMBER :
202- if re .search ("\d$" , function ):
202+ if re .search (r "\d$" , function ):
203203 expected_prefix += "_"
204204 if not test_name .startswith (expected_prefix ):
205205 raise Exception (f"{ filename } :{ lineno } { function } ends with a number, so expected the test name ({ test_name } ) to start with { expected_prefix } " )
@@ -210,7 +210,7 @@ def _check_test(filename, lineno, line, test_macro, function, num_input_args, co
210210 test_suffix = re .sub (f"^{ re .escape (expected_prefix )} " , "" , test_name )
211211 else :
212212 test_suffix = re .sub (f"^{ re .escape (expected_prefix )} _?" , "" , test_name )
213- if not re .match ("^\d+([a-z])?$" , test_suffix ):
213+ if not re .match (r "^\d+([a-z])?$" , test_suffix ):
214214 raise Exception (f"{ filename } :{ lineno } { test_name } has suffix { test_suffix } which doesn't match the expected pattern of a number followed by an optional letter" )
215215 if not suffix_greater (test_suffix , conversion_functions [function ].last_test_suffix ):
216216 raise Exception (f"{ filename } :{ lineno } { test_name } follows { conversion_functions [function ].last_test } but has a smaller suffix" )
@@ -232,12 +232,12 @@ def _check_test(filename, lineno, line, test_macro, function, num_input_args, co
232232 # strip trailing comments
233233 line = re .sub (r"\s*//.*$" , "" , line )
234234 if line :
235- if m := re .match ("^#define (test_check(\w+))\(" , line ):
235+ if m := re .match (r "^#define (test_check(\w+))\(" , line ):
236236 test_macro = m .group (1 )
237237 short_type = m .group (2 )
238238 #print(lineno, line, test_macro)
239239 add_test_macro (test_macros , test_macro , short_type , check .tests_file , lineno )
240- elif m := re .match ("^#define ((\w+)2(\w+))\(([^\)]+)\)" , line ):
240+ elif m := re .match (r "^#define ((\w+)2(\w+))\(([^\)]+)\)" , line ):
241241 conversion_function = m .group (1 )
242242 from_type = m .group (2 )
243243 to_type = m .group (3 )
@@ -248,7 +248,7 @@ def _check_test(filename, lineno, line, test_macro, function, num_input_args, co
248248 else :
249249 if num_input_args != conversion_functions [conversion_function ].num_input_args :
250250 raise Exception (f"{ check .tests_file } :{ lineno } { conversion_function } has a different number of arguments to the counterpart in { check .header_file } " )
251- elif m := re .match ("^\w+ __attribute__\(\(naked\)\) (call_((\w+)2(\w+)))\(([^\)]+)\)" , line ):
251+ elif m := re .match (r "^\w+ __attribute__\(\(naked\)\) (call_((\w+)2(\w+)))\(([^\)]+)\)" , line ):
252252 conversion_function = m .group (1 )
253253 base_function = m .group (2 )
254254 from_type = m .group (3 )
@@ -261,18 +261,18 @@ def _check_test(filename, lineno, line, test_macro, function, num_input_args, co
261261 if num_input_args != conversion_functions [base_function ].num_input_args :
262262 raise Exception (f"{ check .tests_file } :{ lineno } { conversion_function } has a different number of arguments to { base_function } " )
263263 add_conversion_function (conversion_functions , conversion_function , from_type , to_type , num_input_args , check .tests_file , lineno )
264- elif m := re .match ("^static inline (?:float|double) ((\w+)2(\w+_\d+))\(([^\)]+)\)" , line ):
264+ elif m := re .match (r "^static inline (?:float|double) ((\w+)2(\w+_\d+))\(([^\)]+)\)" , line ):
265265 conversion_function = m .group (1 )
266266 from_type = m .group (2 )
267267 to_type = m .group (3 )
268268 num_input_args = len (m .group (4 ).split ("," ))
269269 #print(lineno, line, conversion_function)
270- m = re .match ("^static inline (?:float|double) (\w+2\w+)_\d+\(" , line )
270+ m = re .match (r "^static inline (?:float|double) (\w+2\w+)_\d+\(" , line )
271271 base_function = m .group (1 )
272272 if base_function not in conversion_functions :
273273 raise Exception (f"{ check .tests_file } :{ lineno } { conversion_function } exists but { base_function } doesn't exist" )
274274 add_conversion_function (conversion_functions , conversion_function , from_type , to_type , num_input_args , check .tests_file , lineno )
275- elif m := re .match ("^printf\(\" ((\w+)2(\w+))\\ \\ n\" \);$" , line ):
275+ elif m := re .match (r "^printf\(\"((\w+)2(\w+))\\\\n\"\);$" , line ):
276276 function_group = m .group (1 )
277277 from_type = m .group (2 )
278278 to_type = m .group (3 )
@@ -282,7 +282,7 @@ def _check_test(filename, lineno, line, test_macro, function, num_input_args, co
282282 raise Exception (f"{ check .tests_file } :{ lineno } Function group { function_group } has no corresponding conversion function" )
283283 add_function_group (function_groups , function_group , from_type , to_type , check .tests_file , lineno )
284284 last_function_group = function_group
285- elif m := re .match ("^(test_\w+)\(((\w+?)2(\w+))\(([^\)]+(?:\(.*?\))?)\), ([^,]+), \" (\w+)\" \);$" , line ):
285+ elif m := re .match (r "^(test_\w+)\(((\w+?)2(\w+))\(([^\)]+(?:\(.*?\))?)\), ([^,]+), \"(\w+)\"\);$" , line ):
286286 test_macro = m .group (1 )
287287 function = m .group (2 )
288288 from_type = m .group (3 )
@@ -291,7 +291,7 @@ def _check_test(filename, lineno, line, test_macro, function, num_input_args, co
291291 compare_val = m .group (6 )
292292 test_name = m .group (7 )
293293 _check_test (check .tests_file , lineno , line , test_macro , function , num_input_args , compare_val , to_type , test_name )
294- elif m := re .match ("^(test_\w+)\(((double)2(int))20, ([^,]+), \" (\w+)\" \);$" , line ):
294+ elif m := re .match (r "^(test_\w+)\(((double)2(int))20, ([^,]+), \"(\w+)\"\);$" , line ):
295295 # special-case, because it uses a stored value rather than an inline conversion
296296 test_macro = m .group (1 )
297297 function = m .group (2 )
0 commit comments