|
60 | 60 | 'https://rawgit.com/python-visualization/folium/master/folium/templates/leaflet.awesome.rotate.css'), # noqa |
61 | 61 | ] |
62 | 62 |
|
63 | | -def _validate_location(values): |
| 63 | + |
| 64 | +def _validate_location(location): |
64 | 65 | """Validates and formats location values before setting""" |
65 | | - if type(values) not in [list, tuple]: |
66 | | - raise TypeError("Location is not a list, expecting ex: location=[45.523, -122.675]") |
| 66 | + if type(location) not in [list, tuple]: |
| 67 | + raise TypeError('Expected tuple/list for location, got ' |
| 68 | + '{!r}'.format(location)) |
67 | 69 |
|
68 | | - if len(values) != 2: |
69 | | - raise ValueError("Location should have two values, [lat, lon]") |
| 70 | + if len(location) != 2: |
| 71 | + raise ValueError('Expected two values for location [lat, lon], ' |
| 72 | + 'got {}'.format(len(location))) |
70 | 73 |
|
71 | 74 | try: |
72 | | - values = [float(val) for val in values] |
| 75 | + location = [float(val) for val in location] |
73 | 76 | except: |
74 | | - raise ValueError("Location values should be numeric, {} is not a number".format(val)) |
75 | | - return values |
| 77 | + raise ValueError('Location values must be valid numeric values, ' |
| 78 | + 'got {!r}'.format(location)) |
| 79 | + return location |
76 | 80 |
|
77 | 81 |
|
78 | 82 | class LegacyMap(MacroElement): |
@@ -351,6 +355,7 @@ def render(self, **kwargs): |
351 | 355 |
|
352 | 356 | super(LegacyMap, self).render(**kwargs) |
353 | 357 |
|
| 358 | + |
354 | 359 | class GlobalSwitches(Element): |
355 | 360 | def __init__(self, prefer_canvas=False, no_touch=False, disable_3d=False): |
356 | 361 | super(GlobalSwitches, self).__init__() |
|
0 commit comments