mirror of
https://github.com/codeflash-ai/codeflash.git
synced 2026-05-04 18:25:17 +00:00
fix: guard against None args in try_correct_module_root, fix import ordering
Co-authored-by: Aseem Saxena <aseembits93@users.noreply.github.com>
This commit is contained in:
parent
d8986852ea
commit
0404570fcd
1 changed files with 8 additions and 1 deletions
|
|
@ -9,7 +9,11 @@ import tomlkit
|
|||
|
||||
from codeflash.cli_cmds.cli import project_root_from_module_root
|
||||
from codeflash.cli_cmds.console import console, logger
|
||||
from codeflash.code_utils.code_utils import infer_module_root_from_file, module_name_from_file_path, validate_module_import
|
||||
from codeflash.code_utils.code_utils import (
|
||||
infer_module_root_from_file,
|
||||
module_name_from_file_path,
|
||||
validate_module_import,
|
||||
)
|
||||
from codeflash.code_utils.config_consts import TOTAL_LOOPING_TIME_EFFECTIVE
|
||||
from codeflash.code_utils.config_parser import find_pyproject_toml
|
||||
from codeflash.either import Failure, Success
|
||||
|
|
@ -56,6 +60,9 @@ class PythonFunctionOptimizer(FunctionOptimizer):
|
|||
except ValueError:
|
||||
return False
|
||||
|
||||
if self.args is None:
|
||||
return False
|
||||
|
||||
pyproject_dir = pyproject_path.parent
|
||||
inferred_root = infer_module_root_from_file(self.function_to_optimize.file_path, pyproject_dir)
|
||||
if inferred_root is None or inferred_root.resolve() == self.args.module_root.resolve():
|
||||
|
|
|
|||
Loading…
Reference in a new issue