ilcorsaronero titoli con caratteri speciali e aggiornamento libreria babelfish

This commit is contained in:
marco
2021-11-06 12:17:51 +01:00
parent d21ba2dcb7
commit aafb008d5a
7 changed files with 41 additions and 46 deletions
+3 -4
View File
@@ -7,8 +7,7 @@
from __future__ import unicode_literals
from collections import namedtuple
from functools import partial
# from pkg_resources import resource_stream # @UnresolvedImport
import os, io
from pkg_resources import resource_stream # @UnresolvedImport
from .converters import ConverterManager
from . import basestr
@@ -19,10 +18,10 @@ COUNTRY_MATRIX = []
#: The namedtuple used in the :data:`COUNTRY_MATRIX`
IsoCountry = namedtuple('IsoCountry', ['name', 'alpha2'])
f = io.open(os.path.join(os.path.dirname(__file__), 'data/iso-3166-1.txt'), encoding='utf-8')
f = resource_stream('babelfish', 'data/iso-3166-1.txt')
f.readline()
for l in f:
iso_country = IsoCountry(*l.strip().split(';'))
iso_country = IsoCountry(*l.decode('utf-8').strip().split(';'))
COUNTRIES[iso_country.alpha2] = iso_country.name
COUNTRY_MATRIX.append(iso_country)
f.close()