no longer accept None in result maker functions

This commit is contained in:
Sarah Hoffmann
2025-09-03 21:42:12 +02:00
parent 341c09ee95
commit 8339c2b928
10 changed files with 17 additions and 57 deletions

View File

@@ -19,7 +19,7 @@ from .logging import log
from . import types as ntyp
from . import results as nres
RowFunc = Callable[[Optional[SaRow], Type[nres.BaseResultT]], Optional[nres.BaseResultT]]
RowFunc = Callable[[SaRow, Type[nres.BaseResultT]], nres.BaseResultT]
GEOMETRY_TYPE_MAP = {
'POINT': 'ST_Point',
@@ -74,7 +74,6 @@ class LookupCollector:
for row in await conn.execute(sql):
result = row_func(row, nres.SearchResult)
assert result is not None
if hasattr(row, 'bbox'):
result.bbox = ntyp.Bbox.from_wkb(row.bbox)
@@ -116,7 +115,6 @@ class DetailedCollector:
for row in await conn.execute(sql):
self.result = row_func(row, nres.DetailedResult)
assert self.result is not None
# add missing details
if 'type' in self.result.geometry:
self.result.geometry['type'] = \