]> git.openstreetmap.org Git - nominatim.git/blobdiff - src/nominatim_db/indexer/runners.py
remove remaining pylint hints
[nominatim.git] / src / nominatim_db / indexer / runners.py
index d7737c07230c3d7df4b1579c986ba68d046333df..e20cf20dfcdd044f9ff546128c1c6a0a668e0f54 100644 (file)
@@ -19,11 +19,11 @@ from ..typing import Protocol
 from ..data.place_info import PlaceInfo
 from ..tokenizer.base import AbstractAnalyzer
 
 from ..data.place_info import PlaceInfo
 from ..tokenizer.base import AbstractAnalyzer
 
-# pylint: disable=C0111
 
 def _mk_valuelist(template: str, num: int) -> pysql.Composed:
     return pysql.SQL(',').join([pysql.SQL(template)] * num)
 
 
 def _mk_valuelist(template: str, num: int) -> pysql.Composed:
     return pysql.SQL(',').join([pysql.SQL(template)] * num)
 
+
 def _analyze_place(place: DictRow, analyzer: AbstractAnalyzer) -> Json:
     return Json(analyzer.process_place(PlaceInfo(place)))
 
 def _analyze_place(place: DictRow, analyzer: AbstractAnalyzer) -> Json:
     return Json(analyzer.process_place(PlaceInfo(place)))
 
@@ -41,6 +41,7 @@ SELECT_SQL = pysql.SQL("""SELECT place_id, extra.*
                           LATERAL placex_indexing_prepare(px) as extra """)
 UPDATE_LINE = "(%s, %s::hstore, %s::hstore, %s::int, %s::jsonb)"
 
                           LATERAL placex_indexing_prepare(px) as extra """)
 UPDATE_LINE = "(%s, %s::hstore, %s::hstore, %s::int, %s::jsonb)"
 
+
 class AbstractPlacexRunner:
     """ Returns SQL commands for indexing of the placex table.
     """
 class AbstractPlacexRunner:
     """ Returns SQL commands for indexing of the placex table.
     """
@@ -49,7 +50,6 @@ class AbstractPlacexRunner:
         self.rank = rank
         self.analyzer = analyzer
 
         self.rank = rank
         self.analyzer = analyzer
 
-
     def index_places_query(self, batch_size: int) -> Query:
         return pysql.SQL(
             """ UPDATE placex
     def index_places_query(self, batch_size: int) -> Query:
         return pysql.SQL(
             """ UPDATE placex
@@ -59,7 +59,6 @@ class AbstractPlacexRunner:
                 WHERE place_id = v.id
             """).format(_mk_valuelist(UPDATE_LINE, batch_size))
 
                 WHERE place_id = v.id
             """).format(_mk_valuelist(UPDATE_LINE, batch_size))
 
-
     def index_places_params(self, place: DictRow) -> Sequence[Any]:
         return (place['place_id'],
                 place['name'],
     def index_places_params(self, place: DictRow) -> Sequence[Any]:
         return (place['place_id'],
                 place['name'],
@@ -118,7 +117,6 @@ class InterpolationRunner:
     def __init__(self, analyzer: AbstractAnalyzer) -> None:
         self.analyzer = analyzer
 
     def __init__(self, analyzer: AbstractAnalyzer) -> None:
         self.analyzer = analyzer
 
-
     def name(self) -> str:
         return "interpolation lines (location_property_osmline)"
 
     def name(self) -> str:
         return "interpolation lines (location_property_osmline)"
 
@@ -126,14 +124,12 @@ class InterpolationRunner:
         return """SELECT count(*) FROM location_property_osmline
                   WHERE indexed_status > 0"""
 
         return """SELECT count(*) FROM location_property_osmline
                   WHERE indexed_status > 0"""
 
-
     def sql_get_objects(self) -> Query:
         return """SELECT place_id, get_interpolation_address(address, osm_id) as address
                   FROM location_property_osmline
                   WHERE indexed_status > 0
                   ORDER BY geometry_sector"""
 
     def sql_get_objects(self) -> Query:
         return """SELECT place_id, get_interpolation_address(address, osm_id) as address
                   FROM location_property_osmline
                   WHERE indexed_status > 0
                   ORDER BY geometry_sector"""
 
-
     def index_places_query(self, batch_size: int) -> Query:
         return pysql.SQL("""UPDATE location_property_osmline
                             SET indexed_status = 0, address = v.addr, token_info = v.ti
     def index_places_query(self, batch_size: int) -> Query:
         return pysql.SQL("""UPDATE location_property_osmline
                             SET indexed_status = 0, address = v.addr, token_info = v.ti
@@ -141,13 +137,11 @@ class InterpolationRunner:
                             WHERE place_id = v.id
                          """).format(_mk_valuelist("(%s, %s::hstore, %s::jsonb)", batch_size))
 
                             WHERE place_id = v.id
                          """).format(_mk_valuelist("(%s, %s::hstore, %s::jsonb)", batch_size))
 
-
     def index_places_params(self, place: DictRow) -> Sequence[Any]:
         return (place['place_id'], place['address'],
                 _analyze_place(place, self.analyzer))
 
 
     def index_places_params(self, place: DictRow) -> Sequence[Any]:
         return (place['place_id'], place['address'],
                 _analyze_place(place, self.analyzer))
 
 
-
 class PostcodeRunner(Runner):
     """ Provides the SQL commands for indexing the location_postcode table.
     """
 class PostcodeRunner(Runner):
     """ Provides the SQL commands for indexing the location_postcode table.
     """
@@ -155,22 +149,18 @@ class PostcodeRunner(Runner):
     def name(self) -> str:
         return "postcodes (location_postcode)"
 
     def name(self) -> str:
         return "postcodes (location_postcode)"
 
-
     def sql_count_objects(self) -> Query:
         return 'SELECT count(*) FROM location_postcode WHERE indexed_status > 0'
 
     def sql_count_objects(self) -> Query:
         return 'SELECT count(*) FROM location_postcode WHERE indexed_status > 0'
 
-
     def sql_get_objects(self) -> Query:
         return """SELECT place_id FROM location_postcode
                   WHERE indexed_status > 0
                   ORDER BY country_code, postcode"""
 
     def sql_get_objects(self) -> Query:
         return """SELECT place_id FROM location_postcode
                   WHERE indexed_status > 0
                   ORDER BY country_code, postcode"""
 
-
     def index_places_query(self, batch_size: int) -> Query:
         return pysql.SQL("""UPDATE location_postcode SET indexed_status = 0
                                     WHERE place_id IN ({})""")\
                     .format(pysql.SQL(',').join((pysql.Placeholder() for _ in range(batch_size))))
 
     def index_places_query(self, batch_size: int) -> Query:
         return pysql.SQL("""UPDATE location_postcode SET indexed_status = 0
                                     WHERE place_id IN ({})""")\
                     .format(pysql.SQL(',').join((pysql.Placeholder() for _ in range(batch_size))))
 
-
     def index_places_params(self, place: DictRow) -> Sequence[Any]:
         return (place['place_id'], )
     def index_places_params(self, place: DictRow) -> Sequence[Any]:
         return (place['place_id'], )