From e02e7435073474e57d08e4f60b29a450c15fc3cf Mon Sep 17 00:00:00 2001 From: Wenting Zhao Date: Fri, 20 Sep 2024 16:49:24 +0000 Subject: [PATCH] pre-commit --- baselines/run_agent.py | 2 +- commit0/cli.py | 16 ++++++++++++++-- commit0/harness/docker_build.py | 1 + commit0/harness/utils.py | 4 +++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/baselines/run_agent.py b/baselines/run_agent.py index 0535ba3..9142ae7 100644 --- a/baselines/run_agent.py +++ b/baselines/run_agent.py @@ -52,7 +52,7 @@ def run_agent_for_repo( repo_name = repo_name.replace(".", "-") # Call the commit0 get-tests command to retrieve test files - test_files_str = get_tests(repo_name, stdout=False) + test_files_str = get_tests(repo_name, verbose=0) test_files = sorted(list(set([i.split(":")[0] for i in test_files_str]))) repo_path = os.path.join(commit0_config.base_dir, repo_name) diff --git a/commit0/cli.py b/commit0/cli.py index 8714f1d..b0b0b94 100644 --- a/commit0/cli.py +++ b/commit0/cli.py @@ -77,7 +77,13 @@ def build( ), dataset_split: str = typer.Option("test", help="Split of the Huggingface dataset"), num_workers: int = typer.Option(8, help="Number of workers"), - verbose: int = typer.Option(1, "--verbose", "-v", help="Set this to 2 for more logging information", count=True), + verbose: int = typer.Option( + 1, + "--verbose", + "-v", + help="Set this to 2 for more logging information", + count=True, + ), ) -> None: """Commit0 build a repository.""" check_valid(repo_split, SPLIT) @@ -134,7 +140,13 @@ def test( reference: Annotated[ bool, typer.Option("--reference", help="Test the reference commit.") ] = False, - verbose: int = typer.Option(1, "--verbose", "-v", help="Set this to 2 for more logging information", count=True), + verbose: int = typer.Option( + 1, + "--verbose", + "-v", + help="Set this to 2 for more logging information", + count=True, + ), ) -> None: """Run tests on a Commit0 repository.""" if repo_or_repo_path.endswith("/"): diff --git a/commit0/harness/docker_build.py b/commit0/harness/docker_build.py index affd707..2f7aeea 100644 --- a/commit0/harness/docker_build.py +++ b/commit0/harness/docker_build.py @@ -205,6 +205,7 @@ def build_repo_images( client (docker.DockerClient): Docker client to use for building the images dataset (list): List of test specs or dataset to build images for max_workers (int): Maximum number of workers to use for building images + verbose (int): Level of verbosity Return: ------ diff --git a/commit0/harness/utils.py b/commit0/harness/utils.py index e074fbe..8836415 100644 --- a/commit0/harness/utils.py +++ b/commit0/harness/utils.py @@ -27,7 +27,9 @@ def __str__(self): ) -def setup_logger(repo: str, log_file: Path, mode: str = "w", verbose: int = 1) -> logging.Logger: +def setup_logger( + repo: str, log_file: Path, mode: str = "w", verbose: int = 1 +) -> logging.Logger: """Used for logging the build process of images and running containers. It writes logs to the log file. """