]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Be less fancy in `_PluralTuple`
authorAarni Koskela <akx@iki.fi>
Mon, 13 Jan 2025 11:18:34 +0000 (13:18 +0200)
committerAarni Koskela <akx@iki.fi>
Tue, 14 Jan 2025 07:52:31 +0000 (09:52 +0200)
babel/messages/plurals.py

index cb1ea5b3064b2bd6d2763c5f18647000446ce1a8..1bbd962087d0fdda4d4239a391e68983d5466f7c 100644 (file)
@@ -9,8 +9,6 @@
 """
 from __future__ import annotations
 
-from operator import itemgetter
-
 from babel.core import Locale, default_locale
 
 # XXX: remove this file, duplication with babel.plural
@@ -209,12 +207,21 @@ class _PluralTuple(tuple):
     """A tuple with plural information."""
 
     __slots__ = ()
-    num_plurals = property(itemgetter(0), doc="""
-    The number of plurals used by the locale.""")
-    plural_expr = property(itemgetter(1), doc="""
-    The plural expression used by the locale.""")
-    plural_forms = property(lambda x: 'nplurals={}; plural={};'.format(*x), doc="""
-    The plural expression used by the catalog or locale.""")
+
+    @property
+    def num_plurals(self) -> int:
+        """The number of plurals used by the locale."""
+        return self[0]
+
+    @property
+    def plural_expr(self) -> str:
+        """The plural expression used by the locale."""
+        return self[1]
+
+    @property
+    def plural_forms(self) -> str:
+        """The plural expression used by the catalog or locale."""
+        return f'nplurals={self[0]}; plural={self[1]};'
 
     def __str__(self) -> str:
         return self.plural_forms