Skip to content

Commit

Permalink
move deprecation of default_tms in BaseTilerFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Mar 22, 2024
1 parent 14776fb commit febbe3f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
12 changes: 11 additions & 1 deletion src/titiler/core/titiler/core/factory.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""TiTiler Router factories."""

import abc
import warnings
from dataclasses import dataclass, field
from typing import (
Any,
Expand Down Expand Up @@ -176,7 +177,7 @@ class BaseTilerFactory(metaclass=abc.ABCMeta):

# TileMatrixSet dependency
supported_tms: TileMatrixSets = morecantile_tms
default_tms: str = "WebMercatorQuad"
default_tms: Optional[str] = None

# Router Prefix is needed to find the path for /tile if the TilerFactory.router is mounted
# with other router (multiple `.../tile` routes).
Expand All @@ -197,6 +198,15 @@ class BaseTilerFactory(metaclass=abc.ABCMeta):

def __post_init__(self):
"""Post Init: register route and configure specific options."""
# TODO: remove this in 0.19
if self.default_tms:
warnings.warn(
"`default_tms` attribute is deprecated and will be removed in 0.19.",
DeprecationWarning,
)

self.default_tms = self.default_tms or "WebMercatorQuad"

# Register endpoints
self.register_routes()

Expand Down
13 changes: 0 additions & 13 deletions src/titiler/mosaic/titiler/mosaic/factory.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""TiTiler.mosaic Router factories."""

import os
import warnings
from dataclasses import dataclass
from typing import Callable, Dict, Literal, Optional, Type, Union
from urllib.parse import urlencode
Expand Down Expand Up @@ -75,18 +74,6 @@ class MosaicTilerFactory(BaseTilerFactory):
# Add/Remove some endpoints
add_viewer: bool = True

# TODO: remove `default_tms` and `__post_init__` in 0.19
def __post_init__(self):
"""Post Init."""
if self.default_tms:
warnings.warn(
"`default_tms` attribute is deprecated and will be removed in 0.19.",
DeprecationWarning,
)

self.default_tms = self.default_tms or "WebMercatorQuad"
super().__post_init__()

def register_routes(self):
"""
This Method register routes to the router.
Expand Down

0 comments on commit febbe3f

Please sign in to comment.