jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1337404?usp=email )
Change subject: i18n: Remove unused plural parameter adapter
......................................................................
i18n: Remove unused plural parameter adapter
The plural parameter adapter has no callers after the deprecated
translation paths were removed in 2021. Remove the leftover class
and its unused imports.
Change-Id: I960f9c362abbce4b1c5c1d6d999608cc86b9ee19
---
M pywikibot/i18n.py
1 file changed, 1 insertion(+), 41 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index b8e7f90..624262f 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -25,8 +25,7 @@
import os
import pkgutil
import re
-from collections import abc
-from collections.abc import Generator, Iterable, Iterator, Mapping, Sequence
+from collections.abc import Generator, Iterable, Mapping, Sequence
from contextlib import suppress
from functools import cache
from pathlib import Path
@@ -520,45 +519,6 @@
return re.sub(PLURAL_PATTERN, replace_plural, message)
-class _PluralMappingAlias(abc.Mapping):
-
- """Aliasing class to allow non mappings in _extract_plural.
-
- That function only uses __getitem__ so this is only implemented
- here.
- """
-
- def __init__(
- self,
- source: int | str | Sequence[int] | Mapping[str, int],
- ) -> None:
- self.source = source
- if isinstance(source, str):
- self.source = int(source)
-
- self.index = -1
- super().__init__()
-
- def __getitem__(self, key: str) -> int:
- self.index += 1
- if isinstance(self.source, dict):
- return int(self.source[key])
-
- if isinstance(self.source, (tuple, list)):
- if self.index < len(self.source):
- return int(self.source[self.index])
- raise ValueError('Length of parameter does not match PLURAL '
- 'occurrences.')
- assert isinstance(self.source, int)
- return self.source
-
- def __iter__(self) -> Iterator[int]:
- raise NotImplementedError
-
- def __len__(self) -> int:
- raise NotImplementedError
-
-
DEFAULT_FALLBACK = ('_default', )
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1337404?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I960f9c362abbce4b1c5c1d6d999608cc86b9ee19
Gerrit-Change-Number: 1337404
Gerrit-PatchSet: 1
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]