From e006b7dfae782e2747766c5aca69f02b60aee65c Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Mon, 15 Apr 2024 13:57:03 -0500 Subject: [PATCH] clean up some version_info checks (#218) * clean up some version_info checks * change name to pytools.tag --- pytools/tag.py | 30 ++++++++++++------------------ pytools/test/test_pytools.py | 1 - 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/pytools/tag.py b/pytools/tag.py index 822e55d..7e4f32f 100644 --- a/pytools/tag.py +++ b/pytools/tag.py @@ -28,7 +28,6 @@ Internal stuff that is only here because the documentation tool wants it A type variable with lower bound :class:`Taggable`. """ -import sys from dataclasses import dataclass from typing import ( # noqa: F401 Any, FrozenSet, Iterable, Set, Tuple, Type, TypeVar, Union) @@ -378,23 +377,18 @@ _depr_name_to_replacement_and_obj = { } -if sys.version_info >= (3, 7): - def __getattr__(name): - replacement_and_obj = _depr_name_to_replacement_and_obj.get(name, None) - if replacement_and_obj is not None: - replacement, obj, year = replacement_and_obj - from warnings import warn - warn(f"'arraycontext.{name}' is deprecated. " - f"Use '{replacement}' instead. " - f"'arraycontext.{name}' will continue to work until {year}.", - DeprecationWarning, stacklevel=2) - return obj - else: - raise AttributeError(name) -else: - TagsType = FrozenSet[Tag] - TagOrIterableType = ToTagSetConvertible - T_co = TypeVar("TaggableT", bound="Taggable") +def __getattr__(name): + replacement_and_obj = _depr_name_to_replacement_and_obj.get(name, None) + if replacement_and_obj is not None: + replacement, obj, year = replacement_and_obj + from warnings import warn + warn(f"'pytools.tag.{name}' is deprecated. " + f"Use '{replacement}' instead. " + f"'pytools.tag.{name}' will continue to work until {year}.", + DeprecationWarning, stacklevel=2) + return obj + else: + raise AttributeError(name) # }}} diff --git a/pytools/test/test_pytools.py b/pytools/test/test_pytools.py index 7e1fe3a..991871f 100644 --- a/pytools/test/test_pytools.py +++ b/pytools/test/test_pytools.py @@ -31,7 +31,6 @@ logger = logging.getLogger(__name__) from typing import FrozenSet -@pytest.mark.skipif("sys.version_info < (2, 5)") def test_memoize_method_clear(): from pytools import memoize_method -- GitLab