From fa077f17754b13507c98399c72f9f1c326e806dd Mon Sep 17 00:00:00 2001 From: David Davis <86290+daviddavis@users.noreply.github.com> Date: Mon, 3 Aug 2026 14:08:21 +0000 Subject: [PATCH] Fix lint errors Co-authored-by: GitHub Copilot --- .ci/scripts/check_cli_dependencies.py | 4 ++-- src/pulpcore/cli/workflow/workflow.py | 4 ++-- tests/test_help_pages.py | 19 +++++++++---------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.ci/scripts/check_cli_dependencies.py b/.ci/scripts/check_cli_dependencies.py index 2be24be..6b017bc 100755 --- a/.ci/scripts/check_cli_dependencies.py +++ b/.ci/scripts/check_cli_dependencies.py @@ -26,8 +26,8 @@ def dependencies(path: Path) -> t.Iterator[Requirement]: base_path = Path(__file__).parent.parent.parent glue_path = base_path / GLUE_DIR - cli_dependency = next((r for r in dependencies(base_path) if r.name == "pulp-cli")) - glue_dependency = next((r for r in dependencies(glue_path) if r.name == "pulp-glue")) + cli_dependency = next(r for r in dependencies(base_path) if r.name == "pulp-cli") + glue_dependency = next(r for r in dependencies(glue_path) if r.name == "pulp-glue") if cli_dependency.specifier != glue_dependency.specifier: print("🪢 CLI and GLUE dependencies mismatch:") diff --git a/src/pulpcore/cli/workflow/workflow.py b/src/pulpcore/cli/workflow/workflow.py index fe48432..ffd58a0 100644 --- a/src/pulpcore/cli/workflow/workflow.py +++ b/src/pulpcore/cli/workflow/workflow.py @@ -65,8 +65,8 @@ def create( entity_ctx: PulpEntityContext, /, name: str, - start_time: t.Optional[datetime], - dispatch_interval: t.Optional[str], + start_time: datetime | None, + dispatch_interval: str | None, tasks: tuple[str, ...], pulp_labels: tuple[str, ...], ) -> None: diff --git a/tests/test_help_pages.py b/tests/test_help_pages.py index b062ec6..299be7f 100644 --- a/tests/test_help_pages.py +++ b/tests/test_help_pages.py @@ -10,7 +10,7 @@ load_plugins() -def traverse_commands(command: click.Command, args: t.List[str]) -> t.Iterator[t.List[str]]: +def traverse_commands(command: click.Command, args: list[str]) -> t.Iterator[list[str]]: yield args if isinstance(command, click.Group): @@ -18,15 +18,14 @@ def traverse_commands(command: click.Command, args: t.List[str]) -> t.Iterator[t yield from traverse_commands(sub, args + [name]) params = command.params - if params: - if "--type" in params[0].opts: - # iterate over commands with specific context types - assert isinstance(params[0].type, click.Choice) - for context_type in params[0].type.choices: - yield args + ["--type", context_type] + if params and "--type" in params[0].opts: + # iterate over commands with specific context types + assert isinstance(params[0].type, click.Choice) + for context_type in params[0].type.choices: + yield args + ["--type", context_type] - for name, sub in command.commands.items(): - yield from traverse_commands(sub, args + ["--type", context_type, name]) + for name, sub in command.commands.items(): + yield from traverse_commands(sub, args + ["--type", context_type, name]) @pytest.fixture @@ -45,7 +44,7 @@ def test_access_help(no_api: None) -> None: pytest.skip("This test is incompatible with older cli versions.") runner = CliRunner() - failures: t.List[str] = [] + failures: list[str] = [] for args in traverse_commands(main.commands["workflow"], ["workflow"]): result = runner.invoke(main, args + ["--help"], catch_exceptions=False)