remove language and partition from name import

This commit is contained in:
Sarah Hoffmann 2021-09-01 11:37:30 +02:00
parent 79da96b369
commit 7e7dd769fd
4 changed files with 262 additions and 259 deletions

File diff suppressed because one or more lines are too long

View File

@ -117,7 +117,6 @@ class SetupAll:
LOG.warning('Create search index for default country names.')
country_info.create_country_names(conn, tokenizer,
args.config.LANGUAGES)
conn.commit()
if args.no_updates:
freeze.drop_update_tables(conn)
tokenizer.finalize_import(args.config)

View File

@ -92,17 +92,17 @@ class ICURuleLoader:
value = loader.construct_scalar(node)
if Path(value).is_absolute():
content = Path(value).read_text()
content = Path(value)
else:
content = (self.configfile.parent / value).read_text()
content = (self.configfile.parent / value)
return yaml.safe_load(content)
return yaml.safe_load(content.read_text(encoding='utf-8'))
def _load_from_yaml(self):
yaml.add_constructor('!include', self._yaml_include_representer,
Loader=yaml.SafeLoader)
rules = yaml.safe_load(self.configfile.read_text())
rules = yaml.safe_load(self.configfile.read_text(encoding='utf-8'))
self.normalization_rules = self._cfg_to_icu_rules(rules, 'normalization')
self.transliteration_rules = self._cfg_to_icu_rules(rules, 'transliteration')

View File

@ -15,10 +15,15 @@ class _CountryInfo:
self._info = {}
def load(self, configfile):
""" Load the country properties from the configuration files,
if they are not loaded yet.
"""
if not self._info:
self._info = yaml.safe_load(configfile.read_text())
self._info = yaml.safe_load(configfile.read_text(encoding='utf-8'))
def items(self):
""" Return tuples of (country_code, property dict) as iterable.
"""
return self._info.items()
@ -30,7 +35,6 @@ def setup_country_config(configfile):
file.
"""
_COUNTRY_INFO.load(configfile)
print(_COUNTRY_INFO._info)
def setup_country_tables(dsn, sql_dir, ignore_partitions=False):