diff --git a/pyproject.toml b/pyproject.toml index a28602b64423bad35b6e86159263f0a54be0f326..7a38ca32b7128de206bc89646b21f044d0f878a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ classifiers = [ dependencies = [ "platformdirs>=2.2", # for dataclass_transform with frozen_default - "typing-extensions>=4; python_version<'3.13'", + "typing-extensions>=4", ] [project.optional-dependencies] diff --git a/pytools/__init__.py b/pytools/__init__.py index ff45b90eaec7254ccaf7be27b1fa13b1d2ae01b1..2694de21d112dfd5db8989165029f4d3b93634e0 100644 --- a/pytools/__init__.py +++ b/pytools/__init__.py @@ -32,7 +32,6 @@ import sys from functools import reduce, wraps from sys import intern from typing import ( - TYPE_CHECKING, Any, Callable, ClassVar, @@ -52,22 +51,7 @@ from typing import ( Union, ) - -if TYPE_CHECKING: - # NOTE: mypy seems to be confused by the `try.. except` below when called with - # python -m mypy --python-version 3.8 ... - # see https://github.com/python/mypy/issues/14220 - from typing_extensions import Concatenate, ParamSpec, SupportsIndex -else: - try: - from typing import Concatenate, SupportsIndex - except ImportError: - from typing_extensions import Concatenate, SupportsIndex - - try: - from typing import ParamSpec - except ImportError: - from typing_extensions import ParamSpec # type: ignore[assignment] +from typing_extensions import Concatenate, ParamSpec, SupportsIndex # These are deprecated and will go away in 2022. diff --git a/pytools/graph.py b/pytools/graph.py index baed09958d0c8dc481b6ea447cda8334f0b33716..f00547beb5c3f4f40eaa0b631ce626246ca8b8af 100644 --- a/pytools/graph.py +++ b/pytools/graph.py @@ -69,7 +69,6 @@ Type Variables Used from dataclasses import dataclass from typing import ( - TYPE_CHECKING, Any, Callable, Collection, @@ -89,17 +88,7 @@ from typing import ( TypeVar, ) - -if TYPE_CHECKING: - # NOTE: mypy seems to be confused by the `try.. except` below when called with - # python -m mypy --python-version 3.8 ... - # see https://github.com/python/mypy/issues/14220 - from typing_extensions import TypeAlias -else: - try: - from typing import TypeAlias - except ImportError: - from typing_extensions import TypeAlias +from typing_extensions import TypeAlias NodeT = TypeVar("NodeT", bound=Hashable) diff --git a/pytools/tag.py b/pytools/tag.py index 9055d8d4804d0bdef456ae38a645cef0c8619314..97073de5ad803025c783c80c431133c7df44e1f5 100644 --- a/pytools/tag.py +++ b/pytools/tag.py @@ -39,17 +39,7 @@ from typing import ( ) from warnings import warn - -if TYPE_CHECKING: - # NOTE: mypy seems to be confused by the `try.. except` below when called with - # python -m mypy --python-version 3.8 ... - # see https://github.com/python/mypy/issues/14220 - from typing_extensions import Self, dataclass_transform -else: - try: - from typing import Self, dataclass_transform - except ImportError: - from typing_extensions import Self, dataclass_transform +from typing_extensions import Self, dataclass_transform from pytools import memoize, memoize_method