From d91b58cbb8a2391916681314f6cc51a0377fbb77 Mon Sep 17 00:00:00 2001 From: Uwe Schwaeke Date: Tue, 17 Mar 2026 10:49:09 +0100 Subject: [PATCH 1/2] crt: fix strict Pyright type checking errors * what Assigned unused return values from `git_prepare_remote` and `git_push` to the discard variable `_` in `manifest.py`. Added a `typing.cast` to `Callable[..., str]` for `repo.git.ls_remote` in `git_utils.py`. * why To resolve `reportUnusedCallResult` and `reportAny` errors flagged by stricter Pyright configurations. This explicitly acknowledges intentionally ignored return values and prevents untyped `Any` values from leaking out of the GitPython library, keeping the codebase strictly typed. Co-authored-by: Gemini Signed-off-by: Uwe Schwaeke --- crt/src/crt/cmds/manifest.py | 8 ++++---- crt/src/crt/crtlib/git_utils.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crt/src/crt/cmds/manifest.py b/crt/src/crt/cmds/manifest.py index a0169f9c..20ee2187 100644 --- a/crt/src/crt/cmds/manifest.py +++ b/crt/src/crt/cmds/manifest.py @@ -1171,15 +1171,15 @@ def _prepare_release_repo( release = load_release(ces_patch_path, release_name) release_repo_name = release.base_repo - git_prepare_remote( + _ = git_prepare_remote( ceph_repo_path, f"github.com/{release_repo_name}", release_repo_name, token ) if remote_name != release_repo_name: - git_prepare_remote( + _ = git_prepare_remote( ceph_repo_path, f"github.com/{remote_name}", remote_name, token ) - git_push(ceph_repo_path, release_branch_name, remote_name) - git_push(ceph_repo_path, release_tag_name, remote_name) + _ = git_push(ceph_repo_path, release_branch_name, remote_name) + _ = git_push(ceph_repo_path, release_tag_name, remote_name) except GitError as e: perror(f"unable to prepare release repository: {e}") sys.exit(e.ec if e.ec else errno.ENOTRECOVERABLE) diff --git a/crt/src/crt/crtlib/git_utils.py b/crt/src/crt/crtlib/git_utils.py index cdccabc2..d43695f5 100644 --- a/crt/src/crt/crtlib/git_utils.py +++ b/crt/src/crt/crtlib/git_utils.py @@ -15,6 +15,7 @@ import re import sys import tempfile +from collections.abc import Callable from pathlib import Path from typing import cast, override @@ -814,9 +815,8 @@ def git_format_patch(repo_path: Path, rev: SHA, *, base_rev: SHA | None = None) def git_tag_exists_in_remote(repo_path: Path, remote_name: str, tag_name: str) -> bool: try: repo = git.Repo(repo_path) - raw_tag: str = repo.git.ls_remote( - "--tags", remote_name, f"refs/tags/{tag_name}" - ) + ls_remote = cast(Callable[..., str], repo.git.ls_remote) + raw_tag: str = ls_remote("--tags", remote_name, f"refs/tags/{tag_name}") return bool(raw_tag.strip()) except git.CommandError as e: msg = f"unable to execute git ls-remote --tags {remote_name} refs/tags/{tag_name}: {e}" From daea3cf3afd17e12d0bb710dca30437b430a77f2 Mon Sep 17 00:00:00 2001 From: Uwe Schwaeke Date: Wed, 18 Mar 2026 16:46:49 +0100 Subject: [PATCH 2/2] cbscore: fix strict Pyright type checking errors To resolve `reportUnusedCallResult` errors flagged by stricter Pyright configurations. This explicitly acknowledges intentionally ignored return values. Signed-off-by: Uwe Schwaeke --- cbscore/src/cbscore/images/signing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cbscore/src/cbscore/images/signing.py b/cbscore/src/cbscore/images/signing.py index a2373246..04fd7d92 100644 --- a/cbscore/src/cbscore/images/signing.py +++ b/cbscore/src/cbscore/images/signing.py @@ -69,7 +69,7 @@ def _get_signing_params( def can_sign(registry: str, secrets: SecretsMgr, transit: str) -> bool: try: - _get_signing_params(registry, secrets, transit) + _ = _get_signing_params(registry, secrets, transit) except SigningError as e: logger.debug(e.msg) return False