Coverage for cuda / pathfinder / _utils / platform_aware.py: 75%

8 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2025-12-10 01:19 +0000

1# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 

2# SPDX-License-Identifier: Apache-2.0 

3 

4import sys 

5 

6IS_WINDOWS = sys.platform == "win32" 

7 

8 

9def quote_for_shell(s: str) -> str: 

10 if IS_WINDOWS: 

11 # This is a relatively heavy import; keep pathfinder lean if possible. 

12 from subprocess import list2cmdline 

13 

14 return list2cmdline([s]) 

15 else: 

16 import shlex 

17 

18 return shlex.quote(s)