Skip to content

Commit be2fa3a

Browse files
fix lint issue
1 parent 98fba5e commit be2fa3a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

codeflash/code_utils/formatter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ def format_code(
110110
# lsp mode
111111
exit_on_failure = False
112112

113+
if isinstance(path, str):
114+
path = Path(path)
115+
113116
# TODO: Only allow a particular whitelist of formatters here to prevent arbitrary code execution
114117
formatter_name = formatter_cmds[0].lower() if formatter_cmds else "disabled"
115118
if formatter_name == "disabled":
116119
return path.read_text(encoding="utf8")
117120

118121
with tempfile.TemporaryDirectory() as test_dir_str:
119-
if isinstance(path, str):
120-
path = Path(path)
121-
122122
original_code = path.read_text(encoding="utf8")
123123
original_code_lines = len(original_code.split("\n"))
124124

0 commit comments

Comments
 (0)