summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDanny McClanahan <1305167+cosmicexplorer@users.noreply.github.com>2022-02-11 12:52:01 -0500
committerGitHub <noreply@github.com>2022-02-11 09:52:01 -0800
commite8838109d85fb6966f08083dc7e114bbb35119ad (patch)
treef09223893fa087a71ad2d3ad78a96a7d00b5c6c5 /lib
parent389b24c4dce4762583ced2609b452b8b79687a0e (diff)
downloadspack-e8838109d85fb6966f08083dc7e114bbb35119ad.tar.gz
spack-e8838109d85fb6966f08083dc7e114bbb35119ad.tar.bz2
spack-e8838109d85fb6966f08083dc7e114bbb35119ad.tar.xz
spack-e8838109d85fb6966f08083dc7e114bbb35119ad.zip
move typing_extensions.py back into typing.py =\ (#28549)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/external/py2/typing.py23
-rw-r--r--lib/spack/external/py2/typing_extensions.py26
-rw-r--r--lib/spack/spack/test/llnl/util/tty/log.py6
3 files changed, 26 insertions, 29 deletions
diff --git a/lib/spack/external/py2/typing.py b/lib/spack/external/py2/typing.py
index 7c36962d9f..a74bd4a1ea 100644
--- a/lib/spack/external/py2/typing.py
+++ b/lib/spack/external/py2/typing.py
@@ -1,4 +1,4 @@
-# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
+# Copyright 2013-2022 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)
@@ -80,3 +80,24 @@ get_origin = None
get_type_hints = None
no_type_check = None
no_type_check_decorator = None
+
+## typing_extensions
+# We get a ModuleNotFoundError when attempting to import anything from typing_extensions
+# if we separate this into a separate typing_extensions.py file for some reason.
+
+# (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
diff --git a/lib/spack/external/py2/typing_extensions.py b/lib/spack/external/py2/typing_extensions.py
deleted file mode 100644
index ca6bc10999..0000000000
--- a/lib/spack/external/py2/typing_extensions.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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
diff --git a/lib/spack/spack/test/llnl/util/tty/log.py b/lib/spack/spack/test/llnl/util/tty/log.py
index a5e6d8877d..7e5e728eb0 100644
--- a/lib/spack/spack/test/llnl/util/tty/log.py
+++ b/lib/spack/spack/test/llnl/util/tty/log.py
@@ -11,8 +11,10 @@ import os
import signal
import sys
import time
-from types import ModuleType # novm
-from typing import Optional # novm
+from typing import TYPE_CHECKING, Optional # novm
+
+if TYPE_CHECKING:
+ from types import ModuleType # novm
import pytest