Skip to content

Commit 6967fcb

Browse files
formatting and linting
1 parent caeda49 commit 6967fcb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

codeflash/code_utils/formatter.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import subprocess
99
import tempfile
1010
from pathlib import Path
11-
from typing import Optional
11+
from typing import Optional, Union
1212

1313
import isort
1414

@@ -100,11 +100,16 @@ def is_diff_line(line: str) -> bool:
100100
return len(diff_lines)
101101

102102

103-
def format_code(formatter_cmds: list[str], path: Path, optimized_function: str = "", print_status: bool = True) -> str: # noqa
103+
def format_code(
104+
formatter_cmds: list[str],
105+
path: Union[str, Path],
106+
optimized_function: str = "",
107+
print_status: bool = True, # noqa
108+
) -> str:
104109
with tempfile.TemporaryDirectory() as test_dir_str:
105110
max_diff_lines = 100
106111

107-
if type(path) is str:
112+
if isinstance(path, str):
108113
path = Path(path)
109114

110115
original_code = path.read_text(encoding="utf8")

0 commit comments

Comments
 (0)