Cosmetic: mostly typings

This commit is contained in:
phil 2024-02-13 12:47:07 +05:30
parent df5f67b79d
commit c1f229f805
13 changed files with 120 additions and 69 deletions

View file

@ -7,7 +7,7 @@ from time import time
import logging
import pandas as pd
import geopandas as gpd
import geopandas as gpd # type: ignore[import-untyped]
from asyncpg import connect
from asyncpg.connection import Connection
from asyncpg.exceptions import UndefinedTableError, InterfaceError
@ -167,8 +167,8 @@ class Store:
Additionally, publish to the channel for websocket live updates to ws_clients
"""
if gdf is None:
gdf = gpd.GeoDataFrame(data={'geom': []}, geometry='geom')
if isinstance(gdf.index, pd.core.indexes.multi.MultiIndex):
gdf = gpd.GeoDataFrame(data={'geom': []}, geometry='geom') # type: ignore
if isinstance(gdf.index, pd.MultiIndex):
raise ValueError('Gisaf live does not accept dataframes with multi index')
return await self._store_live_to_redis(live_name, gdf, **kwargs)
@ -205,7 +205,7 @@ class Store:
mapbox_layout['text-field'] = symbol
if not symbol:
symbol = gisTypeSymbolMap.get(gis_type, '\ue02e')
if properties == None:
if properties is None:
properties = []
## Add a column for json representation
columns = {'status', 'popup', gdf.geometry.name, 'store', 'id'}