X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/6e89310a9285f1ad15d8002bf68f578eada367a0..2735ea768aa812998a9498cf411563f118bd6ad6:/src/nominatim_db/tokenizer/token_analysis/generic_mutation.py diff --git a/src/nominatim_db/tokenizer/token_analysis/generic_mutation.py b/src/nominatim_db/tokenizer/token_analysis/generic_mutation.py index 03cc63db..718cc468 100644 --- a/src/nominatim_db/tokenizer/token_analysis/generic_mutation.py +++ b/src/nominatim_db/tokenizer/token_analysis/generic_mutation.py @@ -12,10 +12,11 @@ import itertools import logging import re -from nominatim_core.errors import UsageError +from ...errors import UsageError LOG = logging.getLogger() + def _zigzag(outer: Iterable[str], inner: Iterable[str]) -> Iterator[str]: return itertools.chain.from_iterable(itertools.zip_longest(outer, inner, fillvalue='')) @@ -36,7 +37,6 @@ class MutationVariantGenerator: "This is not allowed.", pattern) raise UsageError("Bad mutation pattern in configuration.") - def generate(self, names: Iterable[str]) -> Iterator[str]: """ Generator function for the name variants. 'names' is an iterable over a set of names for which the variants are to be generated. @@ -49,7 +49,6 @@ class MutationVariantGenerator: for seps in self._fillers(len(parts)): yield ''.join(_zigzag(parts, seps)) - def _fillers(self, num_parts: int) -> Iterator[Tuple[str, ...]]: """ Returns a generator for strings to join the given number of string parts in all possible combinations.