Coverage for cuda / core / _utils / pycompat.py: 75.00%

8 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-05-22 01:37 +0000

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

2# 

3# SPDX-License-Identifier: Apache-2.0 

4 

5""" 

6Compatibility shims for differences between supported Python versions. 

7""" 

8 

9import sys 

10 

11__all__ = ["BufferProtocol", "StrEnum"] 

12 

13 

14if sys.version_info >= (3, 11): 

15 from enum import StrEnum 

16else: 

17 from backports.strenum import StrEnum 

18 

19 

20if sys.version_info >= (3, 12): 

21 from collections.abc import Buffer as BufferProtocol 

22else: 

23 BufferProtocol = object