File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 33import subprocess
44import tempfile
55from functools import lru_cache
6+ from pathlib import Path
67from typing import Optional
78
89from codeflash .cli_cmds .console import logger
@@ -14,7 +15,8 @@ def check_formatter_installed(formatter_cmds: list[str]) -> bool:
1415 if formatter_cmds [0 ] == "disabled" :
1516 return return_code
1617 tmp_code = """print("hello world")"""
17- tmp_file = tempfile .NamedTemporaryFile (suffix = ".py" ).write_text (tmp_code , encoding = "utf8" )
18+ tmp_file = tempfile .NamedTemporaryFile (suffix = ".py" )
19+ Path (tmp_file .name ).write_text (tmp_code , encoding = "utf8" )
1820 file_token = "$file" # noqa: S105
1921 for command in set (formatter_cmds ):
2022 formatter_cmd_list = shlex .split (command , posix = os .name != "nt" )
@@ -23,6 +25,7 @@ def check_formatter_installed(formatter_cmds: list[str]) -> bool:
2325 if result .returncode :
2426 return_code = False
2527 break
28+ tmp_file .close ()
2629 tmp_file .unlink (missing_ok = True )
2730 return return_code
2831
You can’t perform that action at this time.
0 commit comments