File: typing.py

package info (click to toggle)
ansible-core 2.19.0~beta6-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 32,628 kB
  • sloc: python: 180,313; cs: 4,929; sh: 4,601; xml: 34; makefile: 21
file content (25 lines) | stat: -rw-r--r-- 880 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""Compatibility layer for the `typing` module, providing all Python versions access to the newest type-hinting features."""
from __future__ import annotations

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

# catch *all* exceptions to prevent type annotation support module bugs causing runtime failures
# (eg, https://github.com/ansible/ansible/issues/77857)

TYPE_CHECKING = False

try:
    from typing_extensions import *
except Exception:  # pylint: disable=broad-except
    pass

try:
    from typing import *  # type: ignore[assignment,no-redef]
except Exception:  # pylint: disable=broad-except
    pass


# this import and patch occur after typing_extensions/typing imports since the presence of those modules affects dataclasses behavior
from .._internal._patches import _dataclass_annotation_patch

_dataclass_annotation_patch.DataclassesIsTypePatch.patch()