move typing_extensions.py back into typing.py =\ (#28549)
This commit is contained in:
parent
389b24c4dc
commit
e8838109d8
23
lib/spack/external/py2/typing.py
vendored
23
lib/spack/external/py2/typing.py
vendored
@ -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.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
@ -80,3 +80,24 @@
|
|||||||
get_type_hints = None
|
get_type_hints = None
|
||||||
no_type_check = None
|
no_type_check = None
|
||||||
no_type_check_decorator = 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
|
||||||
|
26
lib/spack/external/py2/typing_extensions.py
vendored
26
lib/spack/external/py2/typing_extensions.py
vendored
@ -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
|
|
@ -11,8 +11,10 @@
|
|||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
from typing import TYPE_CHECKING, Optional # novm
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from types import ModuleType # novm
|
from types import ModuleType # novm
|
||||||
from typing import Optional # novm
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user