Skip to content

Commit 337b524

Browse files
committed
formatter
formatter
1 parent 1234502 commit 337b524

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

codeflash/cli_cmds/cli.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def process_and_validate_cmd_args(args: Namespace) -> Namespace:
150150
exit_with_message(
151151
f"Cannot determine repository information: {e}\n"
152152
f"Please ensure your git repository has a remote configured, or use '--no-pr' to optimize locally.",
153-
error_on_exit=True
153+
error_on_exit=True,
154154
)
155155
if args.replay_test:
156156
for test_path in args.replay_test:
@@ -272,15 +272,18 @@ def handle_optimize_all_arg_parsing(args: Namespace) -> Namespace:
272272
apologize_and_exit()
273273
git_remote = getattr(args, "git_remote", None)
274274
if not check_and_push_branch(git_repo, git_remote=git_remote):
275-
exit_with_message("Cannot proceed without a valid git remote configuration. See error message above.", error_on_exit=True)
275+
exit_with_message(
276+
"Cannot proceed without a valid git remote configuration. See error message above.",
277+
error_on_exit=True,
278+
)
276279
try:
277280
owner, repo = get_repo_owner_and_name(git_repo)
278281
require_github_app_or_exit(owner, repo)
279282
except ValueError as e:
280283
exit_with_message(
281284
f"Cannot determine repository information: {e}\n"
282285
f"Please ensure your git repository has a remote configured, or use '--no-pr' to optimize locally.",
283-
error_on_exit=True
286+
error_on_exit=True,
284287
)
285288
if not hasattr(args, "all"):
286289
args.all = None

codeflash/code_utils/git_utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ def get_remote_url(repo: Repo | None = None, git_remote: str | None = "origin")
8282
repository: Repo = repo if repo else git.Repo(search_parent_directories=True)
8383
available_remotes = get_git_remotes(repository)
8484
if not available_remotes:
85-
raise ValueError(f"No git remotes configured in this repository")
85+
raise ValueError("No git remotes configured in this repository")
8686
if git_remote not in available_remotes:
87-
raise ValueError(f"Git remote '{git_remote}' does not exist. Available remotes: {', '.join(available_remotes)}")
87+
msg = f"Git remote '{git_remote}' does not exist. Available remotes: {', '.join(available_remotes)}"
88+
raise ValueError(msg)
8889
return repository.remote(name=git_remote).url
8990

9091

@@ -144,7 +145,7 @@ def check_and_push_branch(repo: git.Repo, git_remote: str | None = "origin", *,
144145
f"Alternatively, you can run codeflash with the '--no-pr' flag to optimize locally without creating PRs."
145146
)
146147
return False
147-
148+
148149
# Check if the specified remote exists
149150
if git_remote not in available_remotes:
150151
logger.error(
@@ -156,7 +157,7 @@ def check_and_push_branch(repo: git.Repo, git_remote: str | None = "origin", *,
156157
f" 3. Run codeflash with '--no-pr' to optimize locally without creating PRs."
157158
)
158159
return False
159-
160+
160161
remote = repo.remote(name=git_remote)
161162

162163
# Check if the branch is pushed

0 commit comments

Comments
 (0)