fix imports for tileserver for real now

This commit is contained in:
Laura Klünder 2025-04-18 01:44:45 +02:00
parent a3c008d590
commit ef8175fafb
4 changed files with 9 additions and 9 deletions

View file

@ -5,9 +5,9 @@ from os import PathLike
from typing import Self, Iterator, Union, TYPE_CHECKING
import numpy as np
from numpy.typing import NDArray
if TYPE_CHECKING:
from numpy.typing import NDArray
from shapely import Polygon, MultiPolygon
from c3nav.mapdata.utils.cache.indexed import LevelGeometryIndexed
@ -75,10 +75,10 @@ class AccessRestrictionAffectedCells:
self.selector = selector
self.values = self._get_values()
def _get_values(self) -> 'NDArray':
def _get_values(self) -> NDArray:
return LevelGeometryIndexed.__getitem__(self.parent, self.selector)
def _set(self, values: 'NDArray'):
def _set(self, values: NDArray):
self.values = values
LevelGeometryIndexed.__setitem__(self.parent, self.selector, values)

View file

@ -12,7 +12,6 @@ try:
except ImportError:
from threading import local as LocalContext
if TYPE_CHECKING:
from shapely import Polygon, MultiPolygon

View file

@ -1,14 +1,16 @@
import struct
from itertools import chain
from os import PathLike
from typing import Optional, Self
from shapely import Polygon, MultiPolygon
from typing import Optional, Self, TYPE_CHECKING, Union
import numpy as np
from c3nav.mapdata.utils.cache.types import MapUpdateTuple
from c3nav.mapdata.utils.cache.indexed import LevelGeometryIndexed
if TYPE_CHECKING:
from shapely import Polygon, MultiPolygon
class MapHistory(LevelGeometryIndexed):
# metadata format:
@ -48,7 +50,7 @@ class MapHistory(LevelGeometryIndexed):
instance.save()
return instance
def add_geometry(self, geometry: Polygon | MultiPolygon, update: MapUpdateTuple):
def add_geometry(self, geometry: Union["Polygon", "MultiPolygon"], update: MapUpdateTuple):
if self.updates[-1] != update:
self.updates.append(update)
@ -67,7 +69,7 @@ class MapHistory(LevelGeometryIndexed):
self.simplify()
super().write(*args, **kwargs)
def composite(self, other: Self, mask_geometry: Optional[Polygon | MultiPolygon]):
def composite(self, other: Self, mask_geometry: Optional[Union["Polygon", "MultiPolygon"]]):
if self.resolution != other.resolution:
raise ValueError('Cannot composite with different resolutions.')

View file

@ -1,6 +1,5 @@
import os
import struct
from collections import namedtuple
from io import BytesIO
from pathlib import Path
from tarfile import TarFile, TarInfo