From 977f3007b95f3e3b9d06f9f564df5faaf532a8d4 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 2 Apr 2025 12:32:50 +0200 Subject: [PATCH] Remove Python 3.8 exclusive branches (#13772) --- .../icalendar/icalendar/timezone/zoneinfo.pyi | 7 +----- stubs/mypy-extensions/mypy_extensions.pyi | 22 +++++++++---------- stubs/regex/regex/regex.pyi | 11 +++------- stubs/six/six/moves/_dummy_thread.pyi | 7 +----- 4 files changed, 15 insertions(+), 32 deletions(-) diff --git a/stubs/icalendar/icalendar/timezone/zoneinfo.pyi b/stubs/icalendar/icalendar/timezone/zoneinfo.pyi index 78f8e9b4f..2e6b6e938 100644 --- a/stubs/icalendar/icalendar/timezone/zoneinfo.pyi +++ b/stubs/icalendar/icalendar/timezone/zoneinfo.pyi @@ -1,14 +1,9 @@ import datetime -import sys from typing import Final, Literal +from zoneinfo import ZoneInfo from dateutil.rrule import rrule, rruleset -if sys.version_info >= (3, 9): - from zoneinfo import ZoneInfo -else: - from backports.zoneinfo import ZoneInfo - from ..cal import Timezone from ..prop import vRecur from .provider import TZProvider diff --git a/stubs/mypy-extensions/mypy_extensions.pyi b/stubs/mypy-extensions/mypy_extensions.pyi index becb31388..0bba94c34 100644 --- a/stubs/mypy-extensions/mypy_extensions.pyi +++ b/stubs/mypy-extensions/mypy_extensions.pyi @@ -1,5 +1,4 @@ import abc -import sys from _collections_abc import dict_items, dict_keys, dict_values from _typeshed import IdentityFunction, Unused from collections.abc import Mapping @@ -27,17 +26,16 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta): def keys(self) -> dict_keys[str, object]: ... def values(self) -> dict_values[str, object]: ... def __delitem__(self, k: Never) -> None: ... - if sys.version_info >= (3, 9): - @overload - def __or__(self, value: Self, /) -> Self: ... - @overload - def __or__(self, value: dict[str, Any], /) -> dict[str, object]: ... - @overload - def __ror__(self, value: Self, /) -> Self: ... - @overload - def __ror__(self, value: dict[str, Any], /) -> dict[str, object]: ... - # supposedly incompatible definitions of `__or__` and `__ior__`: - def __ior__(self, value: Self, /) -> Self: ... # type: ignore[misc] + @overload + def __or__(self, value: Self, /) -> Self: ... + @overload + def __or__(self, value: dict[str, Any], /) -> dict[str, object]: ... + @overload + def __ror__(self, value: Self, /) -> Self: ... + @overload + def __ror__(self, value: dict[str, Any], /) -> dict[str, object]: ... + # supposedly incompatible definitions of `__or__` and `__ior__`: + def __ior__(self, value: Self, /) -> Self: ... # type: ignore[misc] def TypedDict(typename: str, fields: dict[str, type[Any]], total: bool = ...) -> type[dict[str, Any]]: ... @overload diff --git a/stubs/regex/regex/regex.pyi b/stubs/regex/regex/regex.pyi index b77767738..990feb4c6 100644 --- a/stubs/regex/regex/regex.pyi +++ b/stubs/regex/regex/regex.pyi @@ -1,15 +1,12 @@ -import sys from _typeshed import ReadableBuffer, Unused from collections.abc import Callable, Mapping +from types import GenericAlias from typing import Any, AnyStr, Generic, Literal, TypeVar, final, overload from typing_extensions import Self from . import _regex from ._regex_core import * -if sys.version_info >= (3, 9): - from types import GenericAlias - _T = TypeVar("_T") __version__: str @@ -569,8 +566,7 @@ class Pattern(Generic[AnyStr]): ) -> _regex.Scanner[bytes]: ... def __copy__(self) -> Self: ... def __deepcopy__(self, memo: Unused, /) -> Self: ... - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... + def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... @final class Match(Generic[AnyStr]): @@ -648,5 +644,4 @@ class Match(Generic[AnyStr]): def __getitem__(self, key: int | str, /) -> AnyStr | Any: ... def __copy__(self) -> Self: ... def __deepcopy__(self, memo: Unused, /) -> Self: ... - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... + def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... diff --git a/stubs/six/six/moves/_dummy_thread.pyi b/stubs/six/six/moves/_dummy_thread.pyi index 410232d07..25952a614 100644 --- a/stubs/six/six/moves/_dummy_thread.pyi +++ b/stubs/six/six/moves/_dummy_thread.pyi @@ -1,6 +1 @@ -import sys - -if sys.version_info >= (3, 9): - from _thread import * -else: - from _dummy_thread import * +from _thread import *