1515
1616# Package imports
1717import mercantile
18- from typing import Literal
18+ import typing
1919from vt2geojson .tools import vt_bytes_to_geojson
2020
2121# Local imports
@@ -51,8 +51,12 @@ class GeneralAdapter(object):
5151 """
5252
5353 # layer types
54- __LAYER_TYPES = Literal [
55- "overview" , "sequence" , "image" , "map_feature" , "traffic_sign"
54+ __LAYER_TYPES : typing .List [str ] = [
55+ "overview" ,
56+ "sequence" ,
57+ "image" ,
58+ "map_feature" ,
59+ "traffic_sign" ,
5660 ]
5761
5862 def __init__ (self , * args : object ) -> None :
@@ -73,7 +77,7 @@ def fetch_image_tiles(
7377 zoom : int ,
7478 longitude : float ,
7579 latitude : float ,
76- layer : __LAYER_TYPES = "image" ,
80+ layer : str = "image" ,
7781 ) -> dict :
7882 """
7983 Get the tiles for a given image.
@@ -93,7 +97,6 @@ def fetch_image_tiles(
9397
9498 # Perform validation checks
9599 self .__validation_checks (
96- function = self .fetch_image_tiles ,
97100 zoom = zoom ,
98101 longitude = longitude ,
99102 latitude = latitude ,
@@ -114,7 +117,7 @@ def fetch_computed_image_tiles(
114117 zoom : int ,
115118 longitude : float ,
116119 latitude : float ,
117- layer : __LAYER_TYPES = "image" ,
120+ layer : str = "image" ,
118121 ) -> dict :
119122 """
120123 Get the image type for a given image.
@@ -133,7 +136,6 @@ def fetch_computed_image_tiles(
133136 """
134137 # Perform validation checks
135138 self .__validation_checks (
136- function = self .fetch_computed_image_tiles ,
137139 zoom = zoom ,
138140 longitude = longitude ,
139141 latitude = latitude ,
@@ -155,7 +157,7 @@ def fetch_map_features_tiles(
155157 zoom : int ,
156158 longitude : float ,
157159 latitude : float ,
158- layer : __LAYER_TYPES = "image" ,
160+ layer : str = "image" ,
159161 ):
160162 """
161163 Get the map features for a given coordinate set
@@ -174,7 +176,6 @@ def fetch_map_features_tiles(
174176 """
175177 # Perform validation checks
176178 self .__validation_checks (
177- function = self .fetch_map_features_tiles ,
178179 zoom = zoom ,
179180 longitude = longitude ,
180181 latitude = latitude ,
@@ -210,7 +211,6 @@ def fetch_map_features_traffic_tiles(
210211 """
211212 # Perform validation checks
212213 self .__validation_checks (
213- function = self .fetch_map_features_traffic_tiles ,
214214 zoom = zoom ,
215215 longitude = longitude ,
216216 latitude = latitude ,
@@ -241,7 +241,7 @@ def __preprocess_layer(
241241 )
242242
243243 return vt_bytes_to_geojson (
244- # Paramaters appropriately
244+ # Parameters appropriately
245245 b_content = self .client .get (
246246 self .__preprocess_api_string (
247247 # Turn coordinates into a tile
@@ -445,7 +445,12 @@ def __zoom_range_check(self, layer: str, zoom: int):
445445 )
446446
447447 def __validation_checks (
448- self , function , longitude : float , latitude : float , zoom : int , layer : str
448+ self ,
449+ longitude : float ,
450+ latitude : float ,
451+ zoom : int ,
452+ layer : str ,
453+ layer_options : typing .List [str ] = [],
449454 ) -> None :
450455 """
451456 Validation checks for the parameters of longitude, latitude, layer, zoom
@@ -465,7 +470,11 @@ def __validation_checks(
465470 :raises InvalidOptionError: Invalid option passed
466471 """
467472 # Check if the correct literals were passed to the function
468- LiteralEnforcementException .enforce_literal (function = function )
473+ LiteralEnforcementException .enforce_literal (
474+ option_selected = layer ,
475+ options = self .__LAYER_TYPES if layer_options == [] else layer_options ,
476+ param = "layer" ,
477+ )
469478
470479 # Check the parameters for the correct range
471480 self .__check_parameters (longitude , latitude )
0 commit comments