Skip to content

Commit 0404570

Browse files
fix: guard against None args in try_correct_module_root, fix import ordering
Co-authored-by: Aseem Saxena <aseembits93@users.noreply.github.com>
1 parent d898685 commit 0404570

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

codeflash/languages/python/function_optimizer.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99

1010
from codeflash.cli_cmds.cli import project_root_from_module_root
1111
from codeflash.cli_cmds.console import console, logger
12-
from codeflash.code_utils.code_utils import infer_module_root_from_file, module_name_from_file_path, validate_module_import
12+
from codeflash.code_utils.code_utils import (
13+
infer_module_root_from_file,
14+
module_name_from_file_path,
15+
validate_module_import,
16+
)
1317
from codeflash.code_utils.config_consts import TOTAL_LOOPING_TIME_EFFECTIVE
1418
from codeflash.code_utils.config_parser import find_pyproject_toml
1519
from codeflash.either import Failure, Success
@@ -56,6 +60,9 @@ def try_correct_module_root(self) -> bool:
5660
except ValueError:
5761
return False
5862

63+
if self.args is None:
64+
return False
65+
5966
pyproject_dir = pyproject_path.parent
6067
inferred_root = infer_module_root_from_file(self.function_to_optimize.file_path, pyproject_dir)
6168
if inferred_root is None or inferred_root.resolve() == self.args.module_root.resolve():

0 commit comments

Comments
 (0)