Skip to content

Commit b95aa21

Browse files
author
Martin Journois
committed
Enhance docstings in map.py and scroll_zoom_toggler.py
1 parent 2306465 commit b95aa21

2 files changed

Lines changed: 45 additions & 8 deletions

File tree

folium/map.py

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def __init__(self, name=None, overlay=False, control=True):
208208
overlay : bool, default False
209209
Whether the layer is optional (overlay) or compulsory.
210210
control : bool, default True
211-
Whether the Layer will be included in LayerControls
211+
Whether the Layer will be included in LayerControls.
212212
"""
213213
super(Layer, self).__init__()
214214
self.layer_name = name if name is not None else self.get_name()
@@ -217,12 +217,45 @@ def __init__(self, name=None, overlay=False, control=True):
217217

218218

219219
class TileLayer(Layer):
220-
def __init__(self, tiles='OpenStreetMap', name=None,
221-
min_zoom=1, max_zoom=18, attr=None, API_key=None,
222-
overlay=False, control=True, detect_retina=False):
223-
"""TODO docstring here
220+
def __init__(self, tiles='OpenStreetMap', min_zoom=1, max_zoom=18,
221+
attr=None, API_key=None, detect_retina=False,
222+
name=None, overlay=False, control=True):
223+
"""Create a tile layer to append on a Map.
224+
224225
Parameters
225226
----------
227+
tiles: str, default 'OpenStreetMap'
228+
Map tileset to use. Can choose from this list of built-in tiles:
229+
- "OpenStreetMap"
230+
- "MapQuest Open"
231+
- "MapQuest Open Aerial"
232+
- "Mapbox Bright" (Limited levels of zoom for free tiles)
233+
- "Mapbox Control Room" (Limited levels of zoom for free tiles)
234+
- "Stamen" (Terrain, Toner, and Watercolor)
235+
- "Cloudmade" (Must pass API key)
236+
- "Mapbox" (Must pass API key)
237+
- "CartoDB" (positron and dark_matter)
238+
You can pass a custom tileset to Folium by passing a Leaflet-style
239+
URL to the tiles parameter:
240+
http://{s}.yourtiles.com/{z}/{x}/{y}.png
241+
min_zoom: int, default 1
242+
Minimal zoom for which the layer will be displayed.
243+
max_zoom: int, default 18
244+
Maximal zoom for which the layer will be displayed.
245+
attr: string, default None
246+
Map tile attribution; only required if passing custom tile URL.
247+
API_key: str, default None
248+
API key for Cloudmade or Mapbox tiles.
249+
detect_retina: bool, default False
250+
If true and user is on a retina display, it will request four
251+
tiles of half the specified size and a bigger zoom level in place
252+
of one to utilize the high resolution.
253+
name : string, default None
254+
The name of the Layer, as it will appear in LayerControls
255+
overlay : bool, default False
256+
Whether the layer is optional (overlay) or compulsory.
257+
control : bool, default True
258+
Whether the Layer will be included in LayerControls.
226259
"""
227260
self.tile_name = (name if name is not None else
228261
''.join(tiles.lower().strip().split()))
@@ -330,7 +363,7 @@ def __init__(self):
330363
""") # noqa
331364

332365
def render(self, **kwargs):
333-
"""TODO : docstring here."""
366+
"""Renders the HTML representation of the element."""
334367
# We select all Layers for which (control and not overlay).
335368
self.base_layers = OrderedDict(
336369
[(val.layer_name, val.get_name()) for key, val in
@@ -491,7 +524,7 @@ def __init__(self, html=None, max_width=300):
491524
""") # noqa
492525

493526
def render(self, **kwargs):
494-
"""TODO : docstring here."""
527+
"""Renders the HTML representation of the element."""
495528
for name, child in self._children.items():
496529
child.render(**kwargs)
497530

folium/plugins/scroll_zoom_toggler.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212

1313
class ScrollZoomToggler(MacroElement):
1414
def __init__(self):
15-
"""TODO docstring here.
15+
"""Creates a button for enabling/disabling scroll on the Map.
16+
17+
Parameters
18+
----------
19+
1620
"""
1721
super(ScrollZoomToggler, self).__init__()
1822
self._name = 'ScrollZoomToggler'

0 commit comments

Comments
 (0)