]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Unify `str | Locale | None` to `Locale | str | None`
authorAarni Koskela <akx@iki.fi>
Wed, 8 Jan 2025 14:23:08 +0000 (16:23 +0200)
committerAarni Koskela <akx@iki.fi>
Thu, 9 Jan 2025 12:35:40 +0000 (14:35 +0200)
babel/core.py
babel/messages/catalog.py
babel/messages/plurals.py
babel/messages/pofile.py
babel/support.py

index e3fb7c8f732d1698c204cbe1ee7af5a14af949f7..a3ebb40e0bd9dfd7884ce4d6291be676f1d496cc 100644 (file)
@@ -269,7 +269,7 @@ class Locale:
     @classmethod
     def parse(
         cls,
-        identifier: str | Locale | None,
+        identifier: Locale | str | None,
         sep: str = '_',
         resolve_likely_subtags: bool = True,
     ) -> Locale:
index cff22f9b5b9165ebf5bf733727a82da523f7e705..1036ab82690ce41cc23bde270b29e991ab4a3628 100644 (file)
@@ -279,7 +279,7 @@ class Catalog:
 
     def __init__(
         self,
-        locale: str | Locale | None = None,
+        locale: Locale | str | None = None,
         domain: str | None = None,
         header_comment: str | None = DEFAULT_HEADER,
         project: str | None = None,
index 27d81d86fac6b84e4f8b403854d49af6699c6044..cb1ea5b3064b2bd6d2763c5f18647000446ce1a8 100644 (file)
@@ -220,7 +220,7 @@ class _PluralTuple(tuple):
         return self.plural_forms
 
 
-def get_plural(locale: str | None = None) -> _PluralTuple:
+def get_plural(locale: Locale | str | None = None) -> _PluralTuple:
     """A tuple with the information catalogs need to perform proper
     pluralization.  The first item of the tuple is the number of plural
     forms, the second the plural expression.
index 7217076575dbe51a063f38c6d6440396e62f90b8..a292c8a0c261620668673f8d670f93094287821a 100644 (file)
@@ -380,7 +380,7 @@ class PoFileParser:
 
 def read_po(
     fileobj: IO[AnyStr] | Iterable[AnyStr],
-    locale: str | Locale | None = None,
+    locale: Locale | str | None = None,
     domain: str | None = None,
     ignore_obsolete: bool = False,
     charset: str | None = None,
index 7dcda5c6313e5822cfc71b7b9102c8058aecef02..a4484ce08a7a10dc3d42b0455a6ada38ec53495f 100644 (file)
@@ -642,7 +642,7 @@ class Translations(NullTranslations, gettext.GNUTranslations):
     def load(
         cls,
         dirname: str | os.PathLike[str] | None = None,
-        locales: Iterable[str | Locale] | str | Locale | None = None,
+        locales: Iterable[str | Locale] | Locale | str | None = None,
         domain: str | None = None,
     ) -> NullTranslations:
         """Load translations from the given directory.
@@ -709,7 +709,7 @@ class Translations(NullTranslations, gettext.GNUTranslations):
 
 
 def _locales_to_names(
-    locales: Iterable[str | Locale] | str | Locale | None,
+    locales: Iterable[str | Locale] | Locale | str | None,
 ) -> list[str] | None:
     """Normalize a `locales` argument to a list of locale names.