launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25891
[Merge] ~cjwatson/launchpad:remove-languageset-codes-to-languages into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:remove-languageset-codes-to-languages into launchpad:master.
Commit message:
Remove unused LanguageSet.codes_to_languages
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/395694
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-languageset-codes-to-languages into launchpad:master.
diff --git a/lib/lp/services/worlddata/doc/language.txt b/lib/lp/services/worlddata/doc/language.txt
index 4e36fd2..62feb61 100644
--- a/lib/lp/services/worlddata/doc/language.txt
+++ b/lib/lp/services/worlddata/doc/language.txt
@@ -31,19 +31,6 @@ We can convert language codes to standard form.
>>> print(language_set.canonicalise_language_code('pt-br'))
pt_BR
-codes_to_languages
-==================
-
-Convert a list of ISO language codes to language objects. If the code is
-unknown, it's ignored.
-
- # 'zz' code doesn't exist:
- >>> language_set.getLanguageByCode('zz') is None
- True
- >>> languages = language_set.codes_to_languages(['es', 'pt_BR', 'zz'])
- >>> [language.englishname for language in languages]
- [u'Spanish', u'Portuguese (Brazil)']
-
createLanguage
==============
diff --git a/lib/lp/services/worlddata/interfaces/language.py b/lib/lp/services/worlddata/interfaces/language.py
index c2ba6af..82038ac 100644
--- a/lib/lp/services/worlddata/interfaces/language.py
+++ b/lib/lp/services/worlddata/interfaces/language.py
@@ -219,12 +219,6 @@ class ILanguageSet(Interface):
def canonicalise_language_code(code):
"""Convert a language code to standard xx_YY form."""
- def codes_to_languages(codes):
- """Convert a list of ISO language codes to language objects.
-
- Unrecognised language codes are ignored.
- """
-
def createLanguage(code, englishname, nativename=None, pluralforms=None,
pluralexpression=None, visible=True,
direction=TextDirection.LTR):
diff --git a/lib/lp/services/worlddata/model/language.py b/lib/lp/services/worlddata/model/language.py
index 9142207..258fd1f 100644
--- a/lib/lp/services/worlddata/model/language.py
+++ b/lib/lp/services/worlddata/model/language.py
@@ -283,19 +283,6 @@ class LanguageSet:
else:
return code
- def codes_to_languages(self, codes):
- """See `ILanguageSet`."""
-
- languages = []
-
- for code in [self.canonicalise_language_code(code) for code in codes]:
- try:
- languages.append(self[code])
- except KeyError:
- pass
-
- return languages
-
def createLanguage(self, code, englishname, nativename=None,
pluralforms=None, pluralexpression=None, visible=True,
direction=TextDirection.LTR):