From 8d51572192a6def1893cb9a0e86130f61ee105d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <1289205+lahwaacz@users.noreply.github.com> Date: Sat, 22 Jun 2024 09:07:03 +0200 Subject: [PATCH] Remove typing_extensions typing_extensions was used for python<3.8, but this package requires python>=3.8 --- arrow/arrow.py | 7 ++----- arrow/constants.py | 6 +----- arrow/formatter.py | 8 +------- arrow/locales.py | 7 +------ arrow/parser.py | 8 ++------ 5 files changed, 7 insertions(+), 29 deletions(-) diff --git a/arrow/arrow.py b/arrow/arrow.py index 8d329efd..efe1d721 100644 --- a/arrow/arrow.py +++ b/arrow/arrow.py @@ -18,8 +18,10 @@ from typing import ( Any, ClassVar, + Final, Generator, Iterable, + Literal, List, Mapping, Optional, @@ -36,11 +38,6 @@ from arrow.constants import DEFAULT_LOCALE, DEHUMANIZE_LOCALES from arrow.locales import TimeFrameLiteral -if sys.version_info < (3, 8): # pragma: no cover - from typing_extensions import Final, Literal -else: - from typing import Final, Literal # pragma: no cover - TZ_EXPR = Union[dt_tzinfo, str] diff --git a/arrow/constants.py b/arrow/constants.py index 53d163b9..532e9596 100644 --- a/arrow/constants.py +++ b/arrow/constants.py @@ -2,11 +2,7 @@ import sys from datetime import datetime - -if sys.version_info < (3, 8): # pragma: no cover - from typing_extensions import Final -else: - from typing import Final # pragma: no cover +from typing import Final # datetime.max.timestamp() errors on Windows, so we must hardcode # the highest possible datetime value that can output a timestamp. diff --git a/arrow/formatter.py b/arrow/formatter.py index d45f7153..358a2d00 100644 --- a/arrow/formatter.py +++ b/arrow/formatter.py @@ -1,20 +1,14 @@ """Provides the :class:`Arrow ` class, an improved formatter for datetimes.""" import re -import sys from datetime import datetime, timedelta -from typing import Optional, Pattern, cast +from typing import Final, Optional, Pattern, cast from dateutil import tz as dateutil_tz from arrow import locales from arrow.constants import DEFAULT_LOCALE -if sys.version_info < (3, 8): # pragma: no cover - from typing_extensions import Final -else: - from typing import Final # pragma: no cover - FORMAT_ATOM: Final[str] = "YYYY-MM-DD HH:mm:ssZZ" FORMAT_COOKIE: Final[str] = "dddd, DD-MMM-YYYY HH:mm:ss ZZZ" diff --git a/arrow/locales.py b/arrow/locales.py index 34b2a098..cd00b035 100644 --- a/arrow/locales.py +++ b/arrow/locales.py @@ -1,12 +1,12 @@ """Provides internationalization for arrow in over 60 languages and dialects.""" -import sys from math import trunc from typing import ( Any, ClassVar, Dict, List, + Literal, Mapping, Optional, Sequence, @@ -16,11 +16,6 @@ cast, ) -if sys.version_info < (3, 8): # pragma: no cover - from typing_extensions import Literal -else: - from typing import Literal # pragma: no cover - TimeFrameLiteral = Literal[ "now", "second", diff --git a/arrow/parser.py b/arrow/parser.py index 645e3da7..a5c802a1 100644 --- a/arrow/parser.py +++ b/arrow/parser.py @@ -1,7 +1,6 @@ """Provides the :class:`Arrow ` class, a better way to parse datetime strings.""" import re -import sys from datetime import datetime, timedelta from datetime import tzinfo as dt_tzinfo from functools import lru_cache @@ -11,11 +10,13 @@ Dict, Iterable, List, + Literal, Match, Optional, Pattern, SupportsFloat, SupportsInt, + TypedDict, Tuple, Union, cast, @@ -28,11 +29,6 @@ from arrow.constants import DEFAULT_LOCALE from arrow.util import next_weekday, normalize_timestamp -if sys.version_info < (3, 8): # pragma: no cover - from typing_extensions import Literal, TypedDict -else: - from typing import Literal, TypedDict # pragma: no cover - class ParserError(ValueError): pass