Skip to content

Commit caeda49

Browse files
make sure format_code recieves file path as path type not as str
1 parent 90014bd commit caeda49

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

codeflash/code_utils/formatter.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ def format_code(formatter_cmds: list[str], path: Path, optimized_function: str =
104104
with tempfile.TemporaryDirectory() as test_dir_str:
105105
max_diff_lines = 100
106106

107+
if type(path) is str:
108+
path = Path(path)
109+
107110
original_code = path.read_text(encoding="utf8")
108111
# we dont' count the formatting diff for the optimized function as it should be well-formatted (if it's provided)
109112
original_code_without_opfunc = original_code.replace(optimized_function, "")

0 commit comments

Comments
 (0)