add library directories to config

Allows to reduce the number of parameters in functions that take
the config anyway.
This commit is contained in:
Sarah Hoffmann
2021-04-19 09:06:42 +02:00
parent 830e3be1e6
commit 995ba2c7c2
2 changed files with 15 additions and 0 deletions

View File

@@ -39,6 +39,16 @@ class Configuration:
self._config['NOMINATIM_ADDRESS_LEVEL_CONFIG'] = \
str(config_dir / 'address-levels.json')
class _LibDirs: # pylint: disable=too-few-public-methods
pass
self.lib_dir = _LibDirs()
def set_libdirs(self, **kwargs):
""" Set paths to library functions and data.
"""
for key, value in kwargs.items():
setattr(self.lib_dir, key, Path(value).resolve())
def __getattr__(self, name):
name = 'NOMINATIM_' + name