X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c2bdda8895963cece639a9e93ceff31465b518b5..554d25e2e508c57fe763cee95b574b8e7c66eb0b:/nominatim/config.py diff --git a/nominatim/config.py b/nominatim/config.py index 64614bf1..f316280b 100644 --- a/nominatim/config.py +++ b/nominatim/config.py @@ -12,6 +12,27 @@ from nominatim.errors import UsageError LOG = logging.getLogger() + +def flatten_config_list(content, section=''): + """ Flatten YAML configuration lists that contain include sections + which are lists themselves. + """ + if not content: + return [] + + if not isinstance(content, list): + raise UsageError(f"List expected in section '{section}'.") + + output = [] + for ele in content: + if isinstance(ele, list): + output.extend(flatten_config_list(ele, section)) + else: + output.append(ele) + + return output + + class Configuration: """ Load and manage the project configuration.