Skip to content

Commit 7df6ef1

Browse files
committed
Fix docstrings identation
1 parent 30b9e0b commit 7df6ef1

1 file changed

Lines changed: 123 additions & 100 deletions

File tree

folium/features.py

Lines changed: 123 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class WmsTileLayer(TileLayer):
1919
def __init__(self, url, name=None,
2020
format=None, layers=None, transparent=True,
2121
attribution=None):
22-
"""TODO docstring here
23-
Parameters
24-
----------
22+
"""
23+
TODO docstring here
24+
2525
"""
2626
super(TileLayer, self).__init__()
2727
self._name = 'WmsTileLayer'
@@ -56,7 +56,10 @@ def __init__(self, location, popup=None,
5656
color='black', opacity=1, weight=2,
5757
fill_color='blue', fill_opacity=1,
5858
number_of_sides=4, rotation=0, radius=15):
59-
"""TODO : docstring here"""
59+
"""
60+
TODO docstring here
61+
62+
"""
6063
super(RegularPolygonMarker, self).__init__()
6164
self._name = 'RegularPolygonMarker'
6265
self.location = location
@@ -106,7 +109,10 @@ def render(self, **kwargs):
106109
class Vega(Element):
107110
def __init__(self, data, width='100%', height='100%',
108111
left="0%", top="0%", position='relative'):
109-
"""TODO : docstring here"""
112+
"""
113+
TODO docstring here
114+
115+
"""
110116
super(Vega, self).__init__()
111117
self._name = 'Vega'
112118
self.data = data
@@ -164,26 +170,28 @@ def render(self, **kwargs):
164170

165171
class GeoJson(MacroElement):
166172
def __init__(self, data):
167-
"""Creates a GeoJson plugin to append into a map with
173+
"""
174+
Creates a GeoJson plugin to append into a map with
168175
Map.add_plugin.
169176
170177
Parameters
171178
----------
172-
data: file, dict or str.
173-
The GeoJSON data you want to plot.
174-
* If file, then data will be read in the file and fully
175-
embedded in Leaflet's JavaScript.
176-
* If dict, then data will be converted to JSON and embedded
177-
in the JavaScript.
178-
* If str, then data will be passed to the JavaScript as-is.
179-
180-
Examples:
181-
>>> # Providing file.
182-
>>> GeoJson(open('foo.json'))
183-
>>> # Providing dict.
184-
>>> GeoJson(json.load(open('foo.json')))
185-
>>> # Providing string.
186-
>>> GeoJson(open('foo.json').read())
179+
data: file, dict or str.
180+
The GeoJSON data you want to plot.
181+
* If file, then data will be read in the file and fully
182+
embedded in Leaflet's JavaScript.
183+
* If dict, then data will be converted to JSON and embedded
184+
in the JavaScript.
185+
* If str, then data will be passed to the JavaScript as-is.
186+
187+
Examples
188+
--------
189+
>>> # Providing file.
190+
>>> GeoJson(open('foo.json'))
191+
>>> # Providing dict.
192+
>>> GeoJson(json.load(open('foo.json')))
193+
>>> # Providing string.
194+
>>> GeoJson(open('foo.json').read())
187195
188196
"""
189197
super(GeoJson, self).__init__()
@@ -204,7 +212,9 @@ def __init__(self, data):
204212

205213
class TopoJson(MacroElement):
206214
def __init__(self, data, object_path):
207-
"""TODO docstring here.
215+
"""
216+
TODO docstring here
217+
208218
"""
209219
super(TopoJson, self).__init__()
210220
self._name = 'TopoJson'
@@ -244,7 +254,9 @@ def __init__(self, color_domain, color_code, color_data=None,
244254
key_on='feature.properties.color',
245255
weight=1, opacity=1, color='black',
246256
fill_opacity=0.6, dash_array=0):
247-
"""TODO : docstring here.
257+
"""
258+
TODO docstring here
259+
248260
"""
249261
super(GeoJsonStyle, self).__init__()
250262
self._name = 'GeoJsonStyle'
@@ -313,7 +325,9 @@ def render(self, **kwargs):
313325

314326
class ColorScale(MacroElement):
315327
def __init__(self, color_domain, color_code, caption=""):
316-
"""TODO : docstring here.
328+
"""
329+
TODO docstring here
330+
317331
"""
318332
super(ColorScale, self).__init__()
319333
self._name = 'ColorScale'
@@ -436,7 +450,9 @@ def __init__(self, html=None, icon_size=None, icon_anchor=None,
436450
class CircleMarker(MacroElement):
437451
def __init__(self, location, radius=500, color='black',
438452
fill_color='black', fill_opacity=0.6, popup=None):
439-
"""TODO : docstring here
453+
"""
454+
TODO docstring here
455+
440456
"""
441457
super(CircleMarker, self).__init__()
442458
self._name = 'CircleMarker'
@@ -467,7 +483,9 @@ def __init__(self, location, radius=500, color='black',
467483

468484
class LatLngPopup(MacroElement):
469485
def __init__(self):
470-
"""TODO : docstring here
486+
"""
487+
TODO docstring here
488+
471489
"""
472490
super(LatLngPopup, self).__init__()
473491
self._name = 'LatLngPopup'
@@ -489,7 +507,9 @@ def __init__(self):
489507

490508
class ClickForMarker(MacroElement):
491509
def __init__(self, popup=None):
492-
"""TODO : docstring here
510+
"""
511+
TODO docstring here
512+
493513
"""
494514
super(ClickForMarker, self).__init__()
495515
self._name = 'ClickForMarker'
@@ -517,21 +537,22 @@ def __init__(self, popup=None):
517537
class PolyLine(MacroElement):
518538
def __init__(self, locations, color=None, weight=None,
519539
opacity=None, latlon=True):
520-
"""Creates a PolyLine object to append into a map with
540+
"""
541+
Creates a PolyLine object to append into a map with
521542
Map.add_children.
522543
523544
Parameters
524545
----------
525-
locations: list of points (latitude, longitude)
526-
Latitude and Longitude of line (Northing, Easting)
527-
color: string, default Leaflet's default ('#03f')
528-
weight: float, default Leaflet's default (5)
529-
opacity: float, default Leaflet's default (0.5)
530-
latlon: bool, default True
531-
Whether locations are given in the form [[lat, lon]]
532-
or not ([[lon, lat]] if False).
533-
Note that the default GeoJson format is latlon=False,
534-
while Leaflet polyline's default is latlon=True.
546+
locations: list of points (latitude, longitude)
547+
Latitude and Longitude of line (Northing, Easting)
548+
color: string, default Leaflet's default ('#03f')
549+
weight: float, default Leaflet's default (5)
550+
opacity: float, default Leaflet's default (0.5)
551+
latlon: bool, default True
552+
Whether locations are given in the form [[lat, lon]]
553+
or not ([[lon, lat]] if False).
554+
Note that the default GeoJson format is latlon=False,
555+
while Leaflet polyline's default is latlon=True.
535556
"""
536557
super(PolyLine, self).__init__()
537558
self._name = 'PolyLine'
@@ -558,21 +579,22 @@ def __init__(self, locations, color=None, weight=None,
558579
class MultiPolyLine(MacroElement):
559580
def __init__(self, locations, color=None, weight=None,
560581
opacity=None, latlon=True):
561-
"""Creates a MultiPolyLine object to append into a map with
582+
"""
583+
Creates a MultiPolyLine object to append into a map with
562584
Map.add_children.
563585
564586
Parameters
565587
----------
566-
locations: list of points (latitude, longitude)
567-
Latitude and Longitude of line (Northing, Easting)
568-
color: string, default Leaflet's default ('#03f')
569-
weight: float, default Leaflet's default (5)
570-
opacity: float, default Leaflet's default (0.5)
571-
latlon: bool, default True
572-
Whether locations are given in the form [[lat, lon]]
573-
or not ([[lon, lat]] if False).
574-
Note that the default GeoJson format is latlon=False,
575-
while Leaflet polyline's default is latlon=True.
588+
locations: list of points (latitude, longitude)
589+
Latitude and Longitude of line (Northing, Easting)
590+
color: string, default Leaflet's default ('#03f')
591+
weight: float, default Leaflet's default (5)
592+
opacity: float, default Leaflet's default (0.5)
593+
latlon: bool, default True
594+
Whether locations are given in the form [[lat, lon]]
595+
or not ([[lon, lat]] if False).
596+
Note that the default GeoJson format is latlon=False,
597+
while Leaflet polyline's default is latlon=True.
576598
"""
577599
super(MultiPolyLine, self).__init__()
578600
self._name = 'MultiPolyLine'
@@ -599,36 +621,37 @@ def __init__(self, locations, color=None, weight=None,
599621
class ImageOverlay(MacroElement):
600622
def __init__(self, image, bounds, opacity=1., attribution=None,
601623
origin='upper', colormap=None, mercator_project=False):
602-
"""Used to load and display a single image over specific bounds of
624+
"""
625+
Used to load and display a single image over specific bounds of
603626
the map, implements ILayer interface.
604627
605628
Parameters
606629
----------
607-
image: string, file or array-like object
608-
The data you want to draw on the map.
609-
* If string, it will be written directly in the output file.
610-
* If file, it's content will be converted as embedded in the
611-
output file.
612-
* If array-like, it will be converted to PNG base64 string
613-
and embedded in the output.
614-
bounds: list
615-
Image bounds on the map in the form [[lat_min, lon_min],
616-
[lat_max, lon_max]]
617-
opacity: float, default Leaflet's default (1.0)
618-
attr: string, default Leaflet's default ("")
619-
origin : ['upper' | 'lower'], optional, default 'upper'
620-
Place the [0,0] index of the array in the upper left or
621-
lower left corner of the axes.
622-
colormap : callable, used only for `mono` image.
623-
Function of the form [x -> (r,g,b)] or [x -> (r,g,b,a)]
624-
for transforming a mono image into RGB.
625-
It must output iterables of length 3 or 4,
626-
with values between 0 and 1.
627-
Hint : you can use colormaps from `matplotlib.cm`.
628-
mercator_project : bool, default False.
629-
Used only for array-like image. Transforms the data to
630-
project (longitude, latitude) coordinates to the
631-
Mercator projection.
630+
image: string, file or array-like object
631+
The data you want to draw on the map.
632+
* If string, it will be written directly in the output file.
633+
* If file, it's content will be converted as embedded in the
634+
output file.
635+
* If array-like, it will be converted to PNG base64 string
636+
and embedded in the output.
637+
bounds: list
638+
Image bounds on the map in the form [[lat_min, lon_min],
639+
[lat_max, lon_max]]
640+
opacity: float, default Leaflet's default (1.0)
641+
attr: string, default Leaflet's default ("")
642+
origin : ['upper' | 'lower'], optional, default 'upper'
643+
Place the [0,0] index of the array in the upper left or
644+
lower left corner of the axes.
645+
colormap : callable, used only for `mono` image.
646+
Function of the form [x -> (r,g,b)] or [x -> (r,g,b,a)]
647+
for transforming a mono image into RGB.
648+
It must output iterables of length 3 or 4,
649+
with values between 0 and 1.
650+
Hint : you can use colormaps from `matplotlib.cm`.
651+
mercator_project : bool, default False.
652+
Used only for array-like image. Transforms the data to
653+
project (longitude, latitude) coordinates to the
654+
Mercator projection.
632655
633656
"""
634657
super(ImageOverlay, self).__init__()
@@ -665,31 +688,31 @@ def __init__(self, icon_image, icon_size=None, icon_anchor=None,
665688
666689
Parameters
667690
----------
668-
icon_image : string, file or array-like object
669-
The data you want to use as an icon.
670-
* If string, it will be written directly in the output file.
671-
* If file, it's content will be converted as embedded in the
672-
output file.
673-
* If array-like, it will be converted to PNG base64 string
674-
and embedded in the output.
675-
icon_size : tuple of 2 int
676-
Size of the icon image in pixels.
677-
icon_anchor : tuple of 2 int
678-
The coordinates of the "tip" of the icon
679-
(relative to its top left corner).
680-
The icon will be aligned so that this point is at the
681-
marker's geographical location.
682-
shadow_image : string, file or array-like object
683-
The data for the shadow image. If not specified,
684-
no shadow image will be created.
685-
shadow_size : tuple of 2 int
686-
Size of the shadow image in pixels.
687-
shadow_anchor : tuple of 2 int
688-
The coordinates of the "tip" of the shadow relative to its
689-
top left corner (the same as icon_anchor if not specified).
690-
popup_anchor : tuple of 2 int
691-
The coordinates of the point from which popups will "open",
692-
relative to the icon anchor.
691+
icon_image : string, file or array-like object
692+
The data you want to use as an icon.
693+
* If string, it will be written directly in the output file.
694+
* If file, it's content will be converted as embedded in the
695+
output file.
696+
* If array-like, it will be converted to PNG base64 string
697+
and embedded in the output.
698+
icon_size : tuple of 2 int
699+
Size of the icon image in pixels.
700+
icon_anchor : tuple of 2 int
701+
The coordinates of the "tip" of the icon
702+
(relative to its top left corner).
703+
The icon will be aligned so that this point is at the
704+
marker's geographical location.
705+
shadow_image : string, file or array-like object
706+
The data for the shadow image. If not specified,
707+
no shadow image will be created.
708+
shadow_size : tuple of 2 int
709+
Size of the shadow image in pixels.
710+
shadow_anchor : tuple of 2 int
711+
The coordinates of the "tip" of the shadow relative to its
712+
top left corner (the same as icon_anchor if not specified).
713+
popup_anchor : tuple of 2 int
714+
The coordinates of the point from which popups will "open",
715+
relative to the icon anchor.
693716
694717
"""
695718
super(Icon, self).__init__()

0 commit comments

Comments
 (0)