Skip to content

Commit b5bcb0f

Browse files
rename Enums for their singular forms (#261)
1 parent ed9f205 commit b5bcb0f

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
**breaking change**
1111

12-
* renamed `OptionalHeaders`, `MimeTypes` and `ImageDrivers` enums to the singular form. (https://github.com/developmentseed/titiler/pull/258)
12+
* renamed `OptionalHeaders`, `MimeTypes` and `ImageDrivers` enums to the singular form (https://github.com/developmentseed/titiler/pull/258)
13+
* renamed titiler.dependencies's Enums (`ColorMapName`, `ResamplingName` and `TileMatrixSetName`) to the singular form (https://github.com/developmentseed/titiler/pull/260)
1314
* renamed `MimeType` to `MediaType` (https://github.com/developmentseed/titiler/pull/258)
1415
* add `ColorMapParams` dependency to ease the creation of custom colormap dependency (https://github.com/developmentseed/titiler/pull/252)
1516
* renamed `PathParams` to `DatasetPathParams` and also made it a simple callable (https://github.com/developmentseed/titiler/pull/260)

titiler/dependencies.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@
2929
################################################################################
3030
# DO NOT UPDATE
3131
# Create ENUMS with all CMAP and TMS for documentation and validation.
32-
ColorMapNames = Enum( # type: ignore
33-
"ColorMapNames", [(a, a) for a in sorted(cmap.list())]
32+
ColorMapName = Enum( # type: ignore
33+
"ColorMapName", [(a, a) for a in sorted(cmap.list())]
3434
)
35-
ResamplingNames = Enum( # type: ignore
36-
"ResamplingNames", [(r.name, r.name) for r in Resampling]
35+
ResamplingName = Enum( # type: ignore
36+
"ResamplingName", [(r.name, r.name) for r in Resampling]
3737
)
3838
WebMercatorTileMatrixSetName = Enum( # type: ignore
3939
"WebMercatorTileMatrixSetName", [("WebMercatorQuad", "WebMercatorQuad")]
4040
)
41-
TileMatrixSetNames = Enum( # type: ignore
42-
"TileMatrixSetNames", [(a, a) for a in sorted(tms.list())]
41+
TileMatrixSetName = Enum( # type: ignore
42+
"TileMatrixSetName", [(a, a) for a in sorted(tms.list())]
4343
)
4444

4545

@@ -59,8 +59,8 @@ def WebMercatorTMSParams(
5959

6060

6161
def TMSParams(
62-
TileMatrixSetId: TileMatrixSetNames = Query(
63-
TileMatrixSetNames.WebMercatorQuad, # type: ignore
62+
TileMatrixSetId: TileMatrixSetName = Query(
63+
TileMatrixSetName.WebMercatorQuad, # type: ignore
6464
description="TileMatrixSet Name (default: 'WebMercatorQuad')",
6565
)
6666
) -> TileMatrixSet:
@@ -69,7 +69,7 @@ def TMSParams(
6969

7070

7171
def ColorMapParams(
72-
color_map: ColorMapNames = Query(None, description="Colormap name",)
72+
color_map: ColorMapName = Query(None, description="Colormap name",)
7373
) -> Optional[Dict]:
7474
"""Colormap Dependency."""
7575
if color_map:
@@ -302,8 +302,8 @@ class DatasetParams(DefaultDependency):
302302
title="Apply internal Scale/Offset",
303303
description="Apply internal Scale/Offset",
304304
)
305-
resampling_method: ResamplingNames = Query(
306-
ResamplingNames.nearest, description="Resampling method." # type: ignore
305+
resampling_method: ResamplingName = Query(
306+
ResamplingName.nearest, description="Resampling method." # type: ignore
307307
)
308308

309309
def __post_init__(self):

titiler/endpoints/factory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
ImageParams,
3232
MetadataParams,
3333
RenderParams,
34-
TileMatrixSetNames,
34+
TileMatrixSetName,
3535
TMSParams,
3636
WebMercatorTMSParams,
3737
)
@@ -1376,7 +1376,7 @@ class TMSFactory:
13761376
"""TileMatrixSet endpoints Factory."""
13771377

13781378
# Enum of supported TMS
1379-
supported_tms: Type[TileMatrixSetNames] = TileMatrixSetNames
1379+
supported_tms: Type[TileMatrixSetName] = TileMatrixSetName
13801380

13811381
# TileMatrixSet dependency
13821382
tms_dependency: Callable[..., TileMatrixSet] = TMSParams

titiler/endpoints/tms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""TMS Api."""
22

3-
from ..dependencies import TileMatrixSetNames, TMSParams
3+
from ..dependencies import TileMatrixSetName, TMSParams
44
from .factory import TMSFactory
55

6-
tms = TMSFactory(supported_tms=TileMatrixSetNames, tms_dependency=TMSParams)
6+
tms = TMSFactory(supported_tms=TileMatrixSetName, tms_dependency=TMSParams)
77
router = tms.router # noqa

0 commit comments

Comments
 (0)