Skip to content

Commit ceec0ed

Browse files
committed
normalize line prof
1 parent dca0f40 commit ceec0ed

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

codeflash/code_utils/line_profile_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,6 @@ def add_decorator_imports(function_to_optimize: FunctionToOptimize, code_context
219219
file.write(modified_code)
220220
# Adding profile.enable line for changing the savepath of the data, do this only for the main file and not the helper files
221221
file_contents = function_to_optimize.file_path.read_text("utf-8")
222-
modified_code = add_profile_enable(file_contents, str(line_profile_output_file))
222+
modified_code = add_profile_enable(file_contents, line_profile_output_file.as_posix())
223223
function_to_optimize.file_path.write_text(modified_code, "utf-8")
224224
return line_profile_output_file

tests/test_instrument_line_profiler.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_add_decorator_imports_helper_in_class():
3737
line_profiler_output_file = add_decorator_imports(
3838
func_optimizer.function_to_optimize, code_context)
3939
expected_code_main = f"""from line_profiler import profile as codeflash_line_profile
40-
codeflash_line_profile.enable(output_prefix='{line_profiler_output_file}')
40+
codeflash_line_profile.enable(output_prefix='{line_profiler_output_file.as_posix()}')
4141
4242
from code_to_optimize.bubble_sort_in_class import BubbleSortClass
4343
@@ -106,7 +106,7 @@ def test_add_decorator_imports_helper_in_nested_class():
106106
line_profiler_output_file = add_decorator_imports(
107107
func_optimizer.function_to_optimize, code_context)
108108
expected_code_main = f"""from line_profiler import profile as codeflash_line_profile
109-
codeflash_line_profile.enable(output_prefix='{line_profiler_output_file}')
109+
codeflash_line_profile.enable(output_prefix='{line_profiler_output_file.as_posix()}')
110110
111111
from code_to_optimize.bubble_sort_in_nested_class import WrapperClass
112112
@@ -151,7 +151,7 @@ def test_add_decorator_imports_nodeps():
151151
line_profiler_output_file = add_decorator_imports(
152152
func_optimizer.function_to_optimize, code_context)
153153
expected_code_main = f"""from line_profiler import profile as codeflash_line_profile
154-
codeflash_line_profile.enable(output_prefix='{line_profiler_output_file}')
154+
codeflash_line_profile.enable(output_prefix='{line_profiler_output_file.as_posix()}')
155155
156156
157157
@codeflash_line_profile
@@ -200,7 +200,7 @@ def test_add_decorator_imports_helper_outside():
200200
line_profiler_output_file = add_decorator_imports(
201201
func_optimizer.function_to_optimize, code_context)
202202
expected_code_main = f"""from line_profiler import profile as codeflash_line_profile
203-
codeflash_line_profile.enable(output_prefix='{line_profiler_output_file}')
203+
codeflash_line_profile.enable(output_prefix='{line_profiler_output_file.as_posix()}')
204204
205205
from code_to_optimize.bubble_sort_dep1_helper import dep1_comparer
206206
from code_to_optimize.bubble_sort_dep2_swap import dep2_swap
@@ -275,7 +275,7 @@ def __init__(self, arr):
275275
line_profiler_output_file = add_decorator_imports(
276276
func_optimizer.function_to_optimize, code_context)
277277
expected_code_main = f"""from line_profiler import profile as codeflash_line_profile
278-
codeflash_line_profile.enable(output_prefix='{line_profiler_output_file}')
278+
codeflash_line_profile.enable(output_prefix='{line_profiler_output_file.as_posix()}')
279279
280280
281281
@codeflash_line_profile

0 commit comments

Comments
 (0)