import os
import pickle
from collections.abc import Iterable, Mapping
-from typing import TYPE_CHECKING, Any
+from typing import TYPE_CHECKING, Any, Literal
from babel import localedata
from babel.plural import PluralRule
]
if TYPE_CHECKING:
- from typing_extensions import Literal, TypeAlias
+ from typing_extensions import TypeAlias
_GLOBAL_KEY: TypeAlias = Literal[
"all_currencies",
import re
import warnings
from functools import lru_cache
-from typing import TYPE_CHECKING, SupportsInt
+from typing import TYPE_CHECKING, Literal, SupportsInt
try:
import pytz
from babel.localedata import LocaleDataDict
if TYPE_CHECKING:
- from typing_extensions import Literal, TypeAlias
+ from typing_extensions import TypeAlias
_Instant: TypeAlias = datetime.date | datetime.time | float | None
_PredefinedTimeFormat: TypeAlias = Literal['full', 'long', 'medium', 'short']
_Context: TypeAlias = Literal['format', 'stand-alone']
import warnings
from collections.abc import Sequence
-from typing import TYPE_CHECKING
+from typing import Literal
from babel.core import Locale, default_locale
-if TYPE_CHECKING:
- from typing_extensions import Literal
-
-
-
_DEFAULT_LOCALE = default_locale() # TODO(3.0): Remove this.
from os.path import relpath
from textwrap import dedent
from tokenize import COMMENT, NAME, NL, OP, STRING, generate_tokens
-from typing import TYPE_CHECKING, Any
+from typing import TYPE_CHECKING, Any, TypedDict
from babel.messages._compat import find_entrypoints
from babel.util import parse_encoding, parse_future_flags, pathmatch
from typing import IO, Final, Protocol
from _typeshed import SupportsItems, SupportsRead, SupportsReadline
- from typing_extensions import TypeAlias, TypedDict
+ from typing_extensions import TypeAlias
class _PyOptions(TypedDict, total=False):
encoding: str
import os
import re
from collections.abc import Iterable
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Literal
from babel.core import Locale
from babel.messages.catalog import Catalog, Message
from typing import IO, AnyStr
from _typeshed import SupportsWrite
- from typing_extensions import Literal
def unescape(string: str) -> str:
import decimal
import re
import warnings
-from typing import TYPE_CHECKING, Any, cast, overload
+from typing import Any, Literal, cast, overload
from babel.core import Locale, default_locale, get_global
from babel.localedata import LocaleDataDict
-if TYPE_CHECKING:
- from typing_extensions import Literal
-
LC_NUMERIC = default_locale('LC_NUMERIC')
import decimal
import re
from collections.abc import Iterable, Mapping
-from typing import TYPE_CHECKING, Any, Callable
-
-if TYPE_CHECKING:
- from typing_extensions import Literal
+from typing import Any, Callable, Literal
_plural_tags = ('zero', 'one', 'two', 'few', 'many', 'other')
_fallback_tag = 'other'
import locale
import os
from collections.abc import Iterator
-from typing import TYPE_CHECKING, Any, Callable, Iterable
+from typing import TYPE_CHECKING, Any, Callable, Iterable, Literal
from babel.core import Locale
from babel.dates import format_date, format_datetime, format_time, format_timedelta
import datetime as _datetime
from decimal import Decimal
- from typing_extensions import Literal
-
from babel.dates import _PredefinedTimeFormat
from __future__ import annotations
import decimal
-from typing import TYPE_CHECKING
+from typing import Literal
from babel.core import Locale
from babel.numbers import LC_NUMERIC, format_decimal
-if TYPE_CHECKING:
- from typing_extensions import Literal
-
class UnknownUnitError(ValueError):
def __init__(self, unit: str, locale: Locale) -> None: