X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/12a3d51bcc7b1a2aa5eb17c2b2dd36b71ae5610c..1c33cb3186a38ceb5cc4de0975ae1956c861f9b5:/nominatim/tools/special_phrases/sp_csv_loader.py?ds=sidebyside diff --git a/nominatim/tools/special_phrases/sp_csv_loader.py b/nominatim/tools/special_phrases/sp_csv_loader.py index 0bd93c00..400f9fa9 100644 --- a/nominatim/tools/special_phrases/sp_csv_loader.py +++ b/nominatim/tools/special_phrases/sp_csv_loader.py @@ -9,6 +9,7 @@ The class allows to load phrases from a csv file. """ +from typing import Iterable import csv import os from nominatim.tools.special_phrases.special_phrase import SpecialPhrase @@ -18,12 +19,11 @@ class SPCsvLoader: """ Handles loading of special phrases from external csv file. """ - def __init__(self, csv_path): - super().__init__() + def __init__(self, csv_path: str) -> None: self.csv_path = csv_path - def generate_phrases(self): + def generate_phrases(self) -> Iterable[SpecialPhrase]: """ Open and parse the given csv file. Create the corresponding SpecialPhrases. """ @@ -35,7 +35,7 @@ class SPCsvLoader: yield SpecialPhrase(row['phrase'], row['class'], row['type'], row['operator']) - def _check_csv_validity(self): + def _check_csv_validity(self) -> None: """ Check that the csv file has the right extension. """