Skip to content

Commit 2ff1b3f

Browse files
committed
don't
1 parent 90d29d8 commit 2ff1b3f

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

codeflash/code_utils/checkpoint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pathlib import Path
99
from typing import TYPE_CHECKING, Any, Optional
1010

11-
import click
11+
from rich.prompt import Confirm
1212

1313
if TYPE_CHECKING:
1414
import argparse
@@ -139,7 +139,7 @@ def ask_should_use_checkpoint_get_functions(args: argparse.Namespace) -> Optiona
139139
previous_checkpoint_functions = None
140140
if args.all and (sys.platform == "linux" or sys.platform == "darwin") and Path("/tmp").is_dir(): # noqa: S108 #TODO: use the temp dir from codeutils-compat.py
141141
previous_checkpoint_functions = get_all_historical_functions(args.module_root, Path("/tmp")) # noqa: S108
142-
if previous_checkpoint_functions and click.confirm(
142+
if previous_checkpoint_functions and Confirm.ask(
143143
"Previous Checkpoint detected from an incomplete optimization run, shall I continue the optimization from that point?",
144144
default=True,
145145
):

codeflash/code_utils/config_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def find_pyproject_toml(config_file: Path | None = None) -> Path:
2626
return config_file
2727
# Search for pyproject.toml in the parent directories
2828
dir_path = dir_path.parent
29-
msg = f"Could not find pyproject.toml in the current directory {Path.cwd()} or any of the parent directories. Please create it by running `poetry init`, or pass the path to pyproject.toml with the --config-file argument."
29+
msg = f"Could not find pyproject.toml in the current directory {Path.cwd()} or any of the parent directories. Please create it by running `codeflash init`, or pass the path to pyproject.toml with the --config-file argument."
3030

3131
raise ValueError(msg)
3232

codeflash/code_utils/git_utils.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
from typing import TYPE_CHECKING
1313

1414
import git
15-
import inquirer
15+
from rich.prompt import Confirm
1616
from unidiff import PatchSet
1717

18-
from codeflash.cli_cmds.cli_common import inquirer_wrapper
1918
from codeflash.cli_cmds.console import logger
2019
from codeflash.code_utils.config_consts import N_CANDIDATES
2120

@@ -109,11 +108,9 @@ def check_running_in_git_repo(module_root: str) -> bool:
109108

110109
def confirm_proceeding_with_no_git_repo() -> str | bool:
111110
if sys.__stdin__.isatty():
112-
return inquirer_wrapper(
113-
inquirer.confirm,
114-
message="WARNING: I did not find a git repository for your code. If you proceed with running codeflash, "
115-
"optimized code will"
116-
" be written over your current code and you could irreversibly lose your current code. Proceed?",
111+
return Confirm.ask(
112+
"WARNING: I did not find a git repository for your code. If you proceed with running codeflash, "
113+
"optimized code will be written over your current code and you could irreversibly lose your current code. Proceed?",
117114
default=False,
118115
)
119116
# continue running on non-interactive environments, important for GitHub actions
@@ -130,11 +127,9 @@ def check_and_push_branch(repo: git.Repo, wait_for_push: bool = False) -> bool:
130127
if not sys.__stdin__.isatty():
131128
logger.warning("Non-interactive shell detected. Branch will not be pushed.")
132129
return False
133-
if sys.__stdin__.isatty() and inquirer_wrapper(
134-
inquirer.confirm,
135-
message=f"⚡️ In order for me to create PRs, your current branch needs to be pushed. Do you want to push "
136-
f"the branch"
137-
f"'{current_branch}' to the remote repository?",
130+
if sys.__stdin__.isatty() and Confirm.ask(
131+
f"⚡️ In order for me to create PRs, your current branch needs to be pushed. Do you want to push "
132+
f"the branch '{current_branch}' to the remote repository?",
138133
default=False,
139134
):
140135
origin.push(current_branch)

tests/test_git_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_check_running_in_git_repo_not_in_git_repo_non_interactive(self, mock_is
6464

6565
@patch("codeflash.code_utils.git_utils.git.Repo")
6666
@patch("codeflash.code_utils.git_utils.sys.__stdin__.isatty", return_value=True)
67-
@patch("codeflash.code_utils.git_utils.inquirer.confirm", return_value=True)
67+
@patch("codeflash.code_utils.git_utils.Confirm.ask", return_value=True)
6868
def test_check_and_push_branch(self, mock_confirm, mock_isatty, mock_repo):
6969
mock_repo_instance = mock_repo.return_value
7070
mock_repo_instance.active_branch.name = "test-branch"

0 commit comments

Comments
 (0)