summaryrefslogtreecommitdiff
path: root/lib/spack/external/py2/typing_extensions.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/external/py2/typing_extensions.py')
-rw-r--r--lib/spack/external/py2/typing_extensions.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/spack/external/py2/typing_extensions.py b/lib/spack/external/py2/typing_extensions.py
new file mode 100644
index 0000000000..ca6bc10999
--- /dev/null
+++ b/lib/spack/external/py2/typing_extensions.py
@@ -0,0 +1,26 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+"""
+This is a fake set of symbols to allow spack to import typing in python
+versions where we do not support type checking (<3)
+"""
+from collections import defaultdict
+
+# (1) Unparameterized types.
+IntVar = object
+Literal = object
+NewType = object
+Text = object
+
+# (2) Parameterized types.
+Protocol = defaultdict(lambda: object)
+
+# (3) Macro for avoiding evaluation except during type checking.
+TYPE_CHECKING = False
+
+# (4) Decorators.
+final = lambda x: x
+overload = lambda x: x
+runtime_checkable = lambda x: x