Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/ansible_core-2.17.0.dev0-py3.8.egg/ansible/module_utils/compat/typing.py: 0%

14 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2023-11-30 06:38 +0000

1"""Compatibility layer for the `typing` module, providing all Python versions access to the newest type-hinting features.""" 

2from __future__ import annotations 

3 

4# pylint: disable=wildcard-import,unused-wildcard-import 

5 

6# catch *all* exceptions to prevent type annotation support module bugs causing runtime failures 

7# (eg, https://github.com/ansible/ansible/issues/77857) 

8 

9try: 

10 from typing_extensions import * 

11except Exception: # pylint: disable=broad-except 

12 pass 

13 

14try: 

15 from typing import * # type: ignore[assignment,no-redef] 

16except Exception: # pylint: disable=broad-except 

17 pass 

18 

19 

20try: 

21 cast # type: ignore[used-before-def] 

22except NameError: 

23 def cast(typ, val): # type: ignore[no-redef] 

24 return val