Rename util/locale_database/enumdata.py's various *_list to *_map

These variables provide mappings, not lists, so name them non-deceptively.

Change-Id: Idf15e78ad73790bc86dd8b9d4f248d1c4f73993c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
This commit is contained in:
Edward Welbourne 2021-05-04 12:12:00 +02:00
parent 181424d9b5
commit 21e0ef3ccf
3 changed files with 17 additions and 17 deletions

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8; -*-
#############################################################################
##
## Copyright (C) 2020 The Qt Company Ltd.
## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of the Qt Toolkit.
@ -410,10 +410,10 @@ class CldrAccess (object):
for k in self.__parentLocale.keys():
for f in k.split('_'):
scraps.add(f)
from enumdata import language_list, country_list, script_list
language = dict((v, k) for k, v in language_list.values() if not v.isspace())
country = dict((v, k) for k, v in country_list.values() if v != 'ZZ')
script = dict((v, k) for k, v in script_list.values() if v != 'Zzzz')
from enumdata import language_map, country_map, script_map
language = dict((v, k) for k, v in language_map.values() if not v.isspace())
country = dict((v, k) for k, v in country_map.values() if v != 'ZZ')
script = dict((v, k) for k, v in script_map.values() if v != 'Zzzz')
lang = dict(self.__checkEnum(language, self.__codeMap('language'), scraps))
land = dict(self.__checkEnum(country, self.__codeMap('country'), scraps))
text = dict(self.__checkEnum(script, self.__codeMap('script'), scraps))
@ -673,10 +673,10 @@ enumdata.py (keeping the old name as an alias):
# 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.
from enumdata import language_list, script_list, country_list
for form, book, empty in (('language', language_list, 'AnyLanguage'),
('script', script_list, 'AnyScript'),
('country', country_list, 'AnyTerritory')):
from enumdata import language_map, script_map, country_map
for form, book, empty in (('language', language_map, 'AnyLanguage'),
('script', script_map, 'AnyScript'),
('country', country_map, 'AnyTerritory')):
cache[form] = dict((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

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8; -*-
#############################################################################
##
## Copyright (C) 2020 The Qt Company Ltd.
## Copyright (C) 2021 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of the Qt Toolkit.
@ -52,7 +52,7 @@
# languages so closely related to one another that they could also be
# regarded as divergent dialects of the macrolanguage.
language_list = {
language_map = {
0: ("AnyLanguage", " "),
1: ("C", " "),
@ -408,7 +408,7 @@ language_aliases = {
'Kirghiz': 'Kyrgyz'
}
country_list = {
country_map = {
0: ("AnyTerritory", "ZZ"),
1: ("Afghanistan", "AF"),
@ -708,7 +708,7 @@ country_aliases = {
'TuvaluCountry': 'TuvaluTerritory',
}
script_list = {
script_map = {
0: ("AnyScript", "Zzzz"),
1: ("Adlam", "Adlm"),

View File

@ -334,10 +334,10 @@ class QLocaleXmlWriter (object):
# Output of various sections, in their usual order:
def enumData(self):
from enumdata import language_list, script_list, country_list
self.__enumTable('language', language_list)
self.__enumTable('script', script_list)
self.__enumTable('country', country_list)
from enumdata import language_map, script_map, country_map
self.__enumTable('language', language_map)
self.__enumTable('script', script_map)
self.__enumTable('country', country_map)
def likelySubTags(self, entries):
self.__openTag('likelySubtags')