Skip to content

Commit a88c087

Browse files
Merge pull request #296 from emmanuel-ferdman/master
Resolve deprecation warnings of regex library
2 parents ea29129 + a8fad54 commit a88c087

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

kernel_tuner/core.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def prepare_list_of_files(
122122
The files beyond the first are considered additional files that may also contain tunable parameters
123123
124124
For each file beyond the first this function creates a temporary file with
125-
preprocessors statements inserted. Occurences of the original filenames in the
125+
preprocessors statements inserted. Occurrences of the original filenames in the
126126
first file are replaced with their temporary counterparts.
127127
128128
:param kernel_name: A string specifying the kernel name.
@@ -180,7 +180,7 @@ def prepare_list_of_files(
180180
temp_file = util.get_temp_filename(suffix="." + f.split(".")[-1])
181181
temp_files[f] = temp_file
182182
util.write_file(temp_file, ks)
183-
# replace occurences of the additional file's name in the first kernel_string with the name of the temp file
183+
# replace occurrences of the additional file's name in the first kernel_string with the name of the temp file
184184
kernel_string = kernel_string.replace(f, temp_file)
185185

186186
return name, kernel_string, temp_files
@@ -511,7 +511,7 @@ def check_kernel_output(
511511
# run the kernel
512512
check = self.run_kernel(func, gpu_args, instance)
513513
if not check:
514-
return # runtime failure occured that should be ignored, skip correctness check
514+
return # runtime failure occurred that should be ignored, skip correctness check
515515

516516
# retrieve gpu results to host memory
517517
result_host = []
@@ -595,7 +595,7 @@ def compile_and_benchmark(self, kernel_source, gpu_args, params, kernel_options,
595595
if kernel_options.texmem_args is not None:
596596
self.dev.copy_texture_memory_args(kernel_options.texmem_args)
597597

598-
# stop compilation stopwatch and convert to miliseconds
598+
# stop compilation stopwatch and convert to milliseconds
599599
last_compilation_time = 1000 * (time.perf_counter() - start_compilation)
600600

601601
# test kernel for correctness
@@ -628,7 +628,7 @@ def compile_and_benchmark(self, kernel_source, gpu_args, params, kernel_options,
628628
)
629629
raise e
630630

631-
# clean up any temporary files, if no error occured
631+
# clean up any temporary files, if no error occurred
632632
instance.delete_temp_files()
633633

634634
result["compile_time"] = last_compilation_time or 0
@@ -905,7 +905,7 @@ def _flatten(a):
905905
+ " detected during correctness check"
906906
)
907907
print(
908-
"this error occured when checking value of the %oth kernel argument"
908+
"this error occurred when checking value of the %oth kernel argument"
909909
% (i,)
910910
)
911911
print(
@@ -934,7 +934,7 @@ def split_argument_list(argument_list):
934934
match = re.match(regex, arg, re.S)
935935
if not match:
936936
raise ValueError("error parsing templated kernel argument list")
937-
type_list.append(re.sub(r"\s+", " ", match.group(1).strip(), re.S))
937+
type_list.append(re.sub(r"\s+", " ", match.group(1).strip(), flags=re.S))
938938
name_list.append(match.group(2).strip())
939939
return type_list, name_list
940940

@@ -956,7 +956,7 @@ def replace_typename_token(matchobj):
956956
# if the templated typename occurs as a token in the string, meaning that it is enclosed in
957957
# beginning of string or whitespace, and end of string, whitespace or star
958958
regex = r"(^|\s+)(" + k + r")($|\s+|\*)"
959-
sub = re.sub(regex, replace_typename_token, arg_type, re.S)
959+
sub = re.sub(regex, replace_typename_token, arg_type, flags=re.S)
960960
type_list[i] = sub
961961

962962

0 commit comments

Comments
 (0)