Skip to content

Commit

Permalink
fix(agent, benchmark): Specify path_type=Path for CLI path options/…
Browse files Browse the repository at this point in the history
…arguments

Without `path_type=Path`, an option/argument with `type=click.Path()` will return a `str`.
  • Loading branch information
Pwuts committed Jul 3, 2024
1 parent 08612cc commit db0e726
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion autogpt/autogpt/app/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def cli(ctx: click.Context):
@click.option(
"--component-config-file",
help="Path to a json configuration file",
type=click.Path(exists=True, dir_okay=False, resolve_path=True),
type=click.Path(exists=True, dir_okay=False, resolve_path=True, path_type=Path),
)
def run(
continuous: bool,
Expand Down
2 changes: 1 addition & 1 deletion autogpt/scripts/git_log_to_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
help="Path to the git repository",
)
@coroutine
async def generate_release_notes(repo_path: Optional[Path] = None):
async def generate_release_notes(repo_path: Optional[str | Path] = None):
logger = logging.getLogger(generate_release_notes.name) # pyright: ignore

repo = Repo(repo_path, search_parent_directories=True)
Expand Down
4 changes: 3 additions & 1 deletion benchmark/agbenchmark/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def start():
help="Write log output to a file instead of the terminal.",
)
# @click.argument(
# "agent_path", type=click.Path(exists=True, file_okay=False), required=False
# "agent_path",
# type=click.Path(exists=True, file_okay=False, path_type=Path),
# required=False,
# )
def run(
maintain: bool,
Expand Down
5 changes: 4 additions & 1 deletion benchmark/reports/format.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env python3

from pathlib import Path

import click

from agbenchmark.reports.processing.report_types import Report


@click.command()
@click.argument("report_json_file", type=click.Path(exists=True, dir_okay=False))
@click.argument(
"report_json_file", type=click.Path(exists=True, dir_okay=False, path_type=Path)
)
def print_markdown_report(report_json_file: Path):
"""
Generates a Markdown report from a given report.json file.
Expand Down

0 comments on commit db0e726

Please sign in to comment.