Skip to content

Commit b1467bc

Browse files
committed
Be less fancy in _PluralTuple
1 parent c1a8889 commit b1467bc

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

babel/messages/plurals.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
"""
1010
from __future__ import annotations
1111

12-
from operator import itemgetter
13-
1412
from babel.core import Locale, default_locale
1513

1614
# XXX: remove this file, duplication with babel.plural
@@ -209,12 +207,21 @@ class _PluralTuple(tuple):
209207
"""A tuple with plural information."""
210208

211209
__slots__ = ()
212-
num_plurals = property(itemgetter(0), doc="""
213-
The number of plurals used by the locale.""")
214-
plural_expr = property(itemgetter(1), doc="""
215-
The plural expression used by the locale.""")
216-
plural_forms = property(lambda x: 'nplurals={}; plural={};'.format(*x), doc="""
217-
The plural expression used by the catalog or locale.""")
210+
211+
@property
212+
def num_plurals(self) -> int:
213+
"""The number of plurals used by the locale."""
214+
return self[0]
215+
216+
@property
217+
def plural_expr(self) -> str:
218+
"""The plural expression used by the locale."""
219+
return self[1]
220+
221+
@property
222+
def plural_forms(self) -> str:
223+
"""The plural expression used by the catalog or locale."""
224+
return f'nplurals={self[0]}; plural={self[1]};'
218225

219226
def __str__(self) -> str:
220227
return self.plural_forms

0 commit comments

Comments
 (0)