MCPcopy
hub / github.com/python-visualization/folium / validate_multi_locations

Function validate_multi_locations

folium/utilities.py:136–149  ·  view source on GitHub ↗

Validate an iterable with possibly nested lists of coordinate pairs.

(
    locations: TypeMultiLine,
)

Source from the content-addressed store, hash-verified

134
135
136def validate_multi_locations(
137 locations: TypeMultiLine,
138) -> Union[List[List[float]], List[List[List[float]]]]:
139 """Validate an iterable with possibly nested lists of coordinate pairs."""
140 locations = if_pandas_df_convert_to_numpy(locations)
141 _validate_locations_basics(locations)
142 try:
143 float(next(iter(next(iter(next(iter(locations))))))) # type: ignore
144 except (TypeError, StopIteration):
145 # locations is a list of coordinate pairs
146 return [validate_location(coord_pair) for coord_pair in locations] # type: ignore
147 else:
148 # locations is a list of a list of coordinate pairs, recurse
149 return [validate_locations(lst) for lst in locations] # type: ignore
150
151
152def if_pandas_df_convert_to_numpy(obj: Any) -> Any:

Callers 2

__init__Method · 0.90

Calls 4

validate_locationFunction · 0.85
validate_locationsFunction · 0.85

Tested by 1