Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove typing_extensions #1176

Merged
merged 1 commit into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading