Skip to content

Commit 510f470

Browse files
committed
Remove os.path.isdir() tests that are not strictly needed.
1 parent 7cfcbfe commit 510f470

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ def find_nvidia_header_directory(libname: str) -> Optional[str]:
3030
conda_prefix = os.environ.get("CONDA_PREFIX")
3131
if conda_prefix and os.path.isdir(conda_prefix):
3232
hdr_dir = os.path.join(conda_prefix, "include")
33-
if os.path.isdir(hdr_dir):
34-
nvshmem_h_path = os.path.join(hdr_dir, "nvshmem.h")
35-
if os.path.isfile(nvshmem_h_path):
36-
return hdr_dir
33+
nvshmem_h_path = os.path.join(hdr_dir, "nvshmem.h")
34+
if os.path.isfile(nvshmem_h_path):
35+
return hdr_dir
3736

3837
for hdr_dir in sorted(glob.glob("/usr/include/nvshmem_*"), reverse=True):
39-
if os.path.isdir(hdr_dir):
40-
nvshmem_h_path = os.path.join(hdr_dir, "nvshmem.h")
41-
if os.path.isfile(nvshmem_h_path):
42-
return hdr_dir
38+
nvshmem_h_path = os.path.join(hdr_dir, "nvshmem.h")
39+
if os.path.isfile(nvshmem_h_path):
40+
return hdr_dir
4341

4442
return None

0 commit comments

Comments
 (0)