Skip to content

Commit

Permalink
Remove typing_extensions
Browse files Browse the repository at this point in the history
typing_extensions was used for python<3.8, but this package requires
python>=3.8
  • Loading branch information
lahwaacz committed Jun 22, 2024
1 parent 87a1a77 commit f60be3b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 31 deletions.
8 changes: 2 additions & 6 deletions arrow/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
from typing import (
Any,
ClassVar,
Final,
Generator,
Iterable,
List,
Literal,
Mapping,
Optional,
Tuple,
Expand All @@ -36,12 +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]

_T_FRAMES = Literal[
Expand Down
6 changes: 1 addition & 5 deletions arrow/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 1 addition & 8 deletions arrow/formatter.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
"""Provides the :class:`Arrow <arrow.formatter.DateTimeFormatter>` 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"
FORMAT_RFC822: Final[str] = "ddd, DD MMM YY HH:mm:ss Z"
Expand Down
7 changes: 1 addition & 6 deletions arrow/locales.py
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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",
Expand Down
8 changes: 2 additions & 6 deletions arrow/parser.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Provides the :class:`Arrow <arrow.parser.DateTimeParser>` 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
Expand All @@ -11,12 +10,14 @@
Dict,
Iterable,
List,
Literal,
Match,
Optional,
Pattern,
SupportsFloat,
SupportsInt,
Tuple,
TypedDict,
Union,
cast,
overload,
Expand All @@ -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
Expand Down

0 comments on commit f60be3b

Please sign in to comment.