Skip to content

Commit d14dc18

Browse files
committed
fix(pathfinder): satisfy mypy no-any-return in canary helpers
pre-commit.ci mypy flagged returning Any from resolve_ctk_root_via_canary and _resolve_ctk_root_via_canary (both declared -> str | None), because derive_ctk_root resolves to Any under the pathfinder mypy config. Bind the result to an annotated local before returning, matching the pattern used elsewhere in the package.
1 parent c3d39f0 commit d14dc18

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

cuda_pathfinder/cuda/pathfinder/_binaries/find_nvidia_binary_utility.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ def _resolve_ctk_root_via_canary() -> str | None:
7272
"""
7373
from cuda.pathfinder._dynamic_libs.load_nvidia_dynamic_lib import resolve_ctk_root_via_canary
7474

75-
return resolve_ctk_root_via_canary(_CTK_ROOT_CANARY_ANCHOR_LIBNAME)
75+
ctk_root: str | None = resolve_ctk_root_via_canary(_CTK_ROOT_CANARY_ANCHOR_LIBNAME)
76+
return ctk_root
7677

7778

7879
def _resolve_in_trusted_dirs(normalized_name: str, dirs: list[str]) -> str | None:

cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_nvidia_dynamic_lib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ def resolve_ctk_root_via_canary(canary_libname: str) -> str | None:
148148
canary_abs_path = _resolve_system_loaded_abs_path_in_subprocess(canary_libname)
149149
if canary_abs_path is None:
150150
return None
151-
return derive_ctk_root(canary_abs_path)
151+
ctk_root: str | None = derive_ctk_root(canary_abs_path)
152+
return ctk_root
152153

153154

154155
def _try_ctk_root_canary(ctx: SearchContext) -> str | None:

0 commit comments

Comments
 (0)