diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2024-02-08 19:00:00 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2024-02-13 15:58:43 +0100 |
commit | 693bf76306da3ad195c447cb257147a869947de5 (patch) | |
tree | 4c485b55b09a3474475d5b47a56a37c9204c10f6 /util | |
parent | 6463b36da05bf57f2ff5857be6fa56e2c240fe12 (diff) |
Minor tidy-up of CldrAccess.__enumMap: revise comment, modernize code
A comment dated from when variables misleadingly named language_list,
script_list and country_list actually held mappings not lists; they've
been renamed to s/list/map/ a while back, so rephrase.
Use a dict-comprehension rather than the somewhat lisp-ier invocation
of the dict constructor on an iterator over pairs.
Change-Id: Ibcb97122434122dbb1dcb0f621aae02b25a4e1fa
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'util')
-rw-r--r-- | util/locale_database/cldr.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/util/locale_database/cldr.py b/util/locale_database/cldr.py index a725526dbf..345fc50f5f 100644 --- a/util/locale_database/cldr.py +++ b/util/locale_database/cldr.py @@ -636,15 +636,15 @@ enumdata.py (keeping the old name as an alias): def __enumMap(self, key, cache = {}): if not cache: cache['variant'] = {'': (0, 'This should never be seen outside ldml.py')} - # They're not actually lists: mappings from numeric value - # to pairs of full name and short code. What we want, in - # each case, is a mapping from code to the other two. + # They're mappings from numeric value to pairs of full + # name and short code. What we want, in each case, is a + # mapping from code to the other two. from enumdata import language_map, script_map, territory_map for form, book, empty in (('language', language_map, 'AnyLanguage'), ('script', script_map, 'AnyScript'), ('territory', territory_map, 'AnyTerritory')): - cache[form] = dict((pair[1], (num, pair[0])) - for num, pair in book.items() if pair[0] != 'C') + cache[form] = {pair[1]: (num, pair[0]) + for num, pair in book.items() if pair[0] != 'C'} # (Have to filter out the C locale, as we give it the # same (all space) code as AnyLanguage, whose code # should probably be 'und' instead.) |