mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-12 05:44:06 +00:00
remove default parameter for namedtuple
This is only available in Python 3.7.
This commit is contained in:
@@ -68,9 +68,9 @@ class Configuration:
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return int(self.__getattr__(name))
|
return int(self.__getattr__(name))
|
||||||
except ValueError:
|
except ValueError as exp:
|
||||||
LOG.fatal("Invalid setting NOMINATIM_%s. Needs to be a number.", name)
|
LOG.fatal("Invalid setting NOMINATIM_%s. Needs to be a number.", name)
|
||||||
raise UsageError("Configuration error.")
|
raise UsageError("Configuration error.") from exp
|
||||||
|
|
||||||
|
|
||||||
def get_libpq_dsn(self):
|
def get_libpq_dsn(self):
|
||||||
|
|||||||
@@ -7,12 +7,11 @@ import json
|
|||||||
_ICU_VARIANT_PORPERTY_FIELDS = ['lang']
|
_ICU_VARIANT_PORPERTY_FIELDS = ['lang']
|
||||||
|
|
||||||
|
|
||||||
class ICUVariantProperties(namedtuple('_ICUVariantProperties', _ICU_VARIANT_PORPERTY_FIELDS,
|
class ICUVariantProperties(namedtuple('_ICUVariantProperties', _ICU_VARIANT_PORPERTY_FIELDS)):
|
||||||
defaults=(None, )*len(_ICU_VARIANT_PORPERTY_FIELDS))):
|
|
||||||
""" Data container for saving properties that describe when a variant
|
""" Data container for saving properties that describe when a variant
|
||||||
should be applied.
|
should be applied.
|
||||||
|
|
||||||
Porperty instances are hashable.
|
Property instances are hashable.
|
||||||
"""
|
"""
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_rules(cls, _):
|
def from_rules(cls, _):
|
||||||
@@ -52,7 +51,7 @@ def unpickle_variant_set(variant_string):
|
|||||||
"""
|
"""
|
||||||
data = json.loads(variant_string)
|
data = json.loads(variant_string)
|
||||||
|
|
||||||
properties = {int(k): ICUVariantProperties(**v) for k, v in data['properties'].items()}
|
properties = {int(k): ICUVariantProperties.from_rules(v)
|
||||||
print(properties)
|
for k, v in data['properties'].items()}
|
||||||
|
|
||||||
return set((ICUVariant(src, repl, properties[pid]) for src, repl, pid in data['variants']))
|
return set((ICUVariant(src, repl, properties[pid]) for src, repl, pid in data['variants']))
|
||||||
|
|||||||
Reference in New Issue
Block a user