Skip to content

Commit 83dbef7

Browse files
committed
Change location data type restriction from Iterable to
Collection.
1 parent d5d72b6 commit 83dbef7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

folium/utilities.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@
2525

2626
def _validate_location(location):
2727
"""Validates and formats location values before setting."""
28-
if _isnan(location):
29-
raise ValueError('Location values cannot contain NaNs, '
30-
'got {!r}'.format(location))
31-
if isinstance(type(location), collections.abc.Iterable):
32-
raise TypeError('Expected Iterable object for location, got '
28+
if not isinstance(location, collections.abc.Collection):
29+
raise TypeError('Expected a collection object for location, got '
3330
'{!r}'.format(location))
34-
3531
if len(location) != 2:
3632
raise ValueError('Expected two values for location [lat, lon], '
3733
'got {}'.format(len(location)))
34+
if _isnan(location):
35+
raise ValueError('Location values cannot contain NaNs, '
36+
'got {!r}'.format(location))
37+
3838
location = _iter_tolist(location)
3939
return location
4040

@@ -58,7 +58,7 @@ def _iter_tolist(x):
5858

5959
def _flatten(container):
6060
for i in container:
61-
if isinstance(i, (list, tuple, np.ndarray)):
61+
if isinstance(i, collections.abc.Collection):
6262
for j in _flatten(i):
6363
yield j
6464
else:

0 commit comments

Comments
 (0)