Skip to content

Commit f827aa3

Browse files
author
Martin Journois
committed
Docstring cleanig, again
1 parent 1203ef6 commit f827aa3

5 files changed

Lines changed: 60 additions & 51 deletions

File tree

folium/colormap.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
-------
55
66
Utility module for dealing with colormaps.
7-
87
"""
8+
99
from __future__ import absolute_import
1010

1111
import math
@@ -264,8 +264,7 @@ class ColorMap(MacroElement):
264264
265265
Parameters
266266
----------
267-
TODO: docstring
268-
"""
267+
TODO: docstring"""
269268

270269
def __init__(self, vmin=0., vmax=1., caption=""):
271270
super(ColorMap, self).__init__()
@@ -349,13 +348,14 @@ class LinearColormap(ColorMap):
349348
350349
Parameters
351350
----------
351+
352352
colors : list-like object
353353
The set of colors to be used for interpolation.
354354
Colors can be provided in the form:
355355
* tuples of int between 0 and 255 (e.g: `(255,255,0)` or
356-
`(255, 255, 0, 255)`)
356+
`(255, 255, 0, 255)`)
357357
* tuples of floats between 0. and 1. (e.g: `(1.,1.,0.)` or
358-
`(1., 1., 0., 1.)`)
358+
`(1., 1., 0., 1.)`)
359359
* HTML-like string (e.g: `"#ffff00`)
360360
* a color name or shortcut (e.g: `"y"` or `"yellow"`)
361361
index : list of floats, default None
@@ -367,8 +367,8 @@ class LinearColormap(ColorMap):
367367
Values lower than `vmin` will be bound directly to `colors[0]`.
368368
vmax : float, default 1.
369369
The maximal value for the colormap.
370-
Values higher than `vmax` will be bound directly to `colors[-1]`.
371-
"""
370+
Values higher than `vmax` will be bound directly to `colors[-1]`."""
371+
372372
def __init__(self, colors, index=None, vmin=0., vmax=1., caption=""):
373373
super(LinearColormap, self).__init__(vmin=vmin, vmax=vmax,
374374
caption=caption)
@@ -404,8 +404,7 @@ def rgba_floats_tuple(self, x):
404404

405405
def to_step(self, n=None, index=None, data=None, method=None,
406406
quantiles=None, round_method=None):
407-
"""
408-
Splits the LinearColormap into a StepColormap.
407+
"""Splits the LinearColormap into a StepColormap.
409408
410409
Parameters
411410
----------
@@ -429,8 +428,8 @@ def to_step(self, n=None, index=None, data=None, method=None,
429428
The method used to round thresholds.
430429
* If 'int', all values will be rounded to the nearest integer.
431430
* If 'log10', all values will be rounded to the nearest
432-
order-of-magnitude integer. For example, 2100 is rounded to
433-
2000, 2790 to 3000.
431+
order-of-magnitude integer. For example, 2100 is rounded to
432+
2000, 2790 to 3000.
434433
435434
Returns
436435
-------
@@ -534,9 +533,9 @@ class StepColormap(ColorMap):
534533
The set of colors to be used for interpolation.
535534
Colors can be provided in the form:
536535
* tuples of int between 0 and 255 (e.g: `(255,255,0)` or
537-
`(255, 255, 0, 255)`)
536+
`(255, 255, 0, 255)`)
538537
* tuples of floats between 0. and 1. (e.g: `(1.,1.,0.)` or
539-
`(1., 1., 0., 1.)`)
538+
`(1., 1., 0., 1.)`)
540539
* HTML-like string (e.g: `"#ffff00`)
541540
* a color name or shortcut (e.g: `"y"` or `"yellow"`)
542541
index : list of floats, default None

folium/element.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -583,20 +583,23 @@ def render(self, **kwargs):
583583
class MacroElement(Element):
584584
"""This is a parent class for Elements defined by a macro template.
585585
To compute your own element, all you have to do is:
586-
* To inherit from this class
587-
* Overwrite the '_name' attribute
588-
* Overwrite the '_template' attribute with something of the form:
589-
{% macro header(this, kwargs) %}
590-
...
591-
{% endmacro %}
592-
593-
{% macro html(this, kwargs) %}
594-
...
595-
{% endmacro %}
596-
597-
{% macro script(this, kwargs) %}
598-
...
599-
{% endmacro %}
586+
587+
* To inherit from this class
588+
* Overwrite the '_name' attribute
589+
* Overwrite the '_template' attribute with something of the form::
590+
591+
{% macro header(this, kwargs) %}
592+
...
593+
{% endmacro %}
594+
595+
{% macro html(this, kwargs) %}
596+
...
597+
{% endmacro %}
598+
599+
{% macro script(this, kwargs) %}
600+
...
601+
{% endmacro %}
602+
600603
"""
601604
def __init__(self):
602605
super(MacroElement, self).__init__()

folium/features.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ class GeoJson(Layer):
248248
data: file, dict or str.
249249
The GeoJSON data you want to plot.
250250
* If file, then data will be read in the file and fully
251-
embedded in Leaflet's JavaScript.
251+
embedded in Leaflet's JavaScript.
252252
* If dict, then data will be converted to JSON and embedded
253-
in the JavaScript.
253+
in the JavaScript.
254254
* If str, then data will be passed to the JavaScript as-is.
255255
style_function: function, default None
256256
A function mapping a GeoJson Feature to a style dict.
@@ -372,9 +372,9 @@ class TopoJson(Layer):
372372
data: file, dict or str.
373373
The TopoJSON data you want to plot.
374374
* If file, then data will be read in the file and fully
375-
embedded in Leaflet's JavaScript.
375+
embedded in Leaflet's JavaScript.
376376
* If dict, then data will be converted to JSON and embedded
377-
in the JavaScript.
377+
in the JavaScript.
378378
* If str, then data will be passed to the JavaScript as-is.
379379
object_path: str
380380
The path of the desired object into the TopoJson structure.
@@ -832,9 +832,9 @@ class CustomIcon(Icon):
832832
The data you want to use as an icon.
833833
* If string, it will be written directly in the output file.
834834
* If file, it's content will be converted as embedded in the
835-
output file.
835+
output file.
836836
* If array-like, it will be converted to PNG base64 string
837-
and embedded in the output.
837+
and embedded in the output.
838838
icon_size : tuple of 2 int
839839
Size of the icon image in pixels.
840840
icon_anchor : tuple of 2 int

folium/folium.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Map(LegacyMap):
3636
Generate a base map of given width and height with either default
3737
tilesets or a custom tileset URL. The following tilesets are built-in
3838
to Folium. Pass any of the following to the "tiles" keyword:
39+
3940
- "OpenStreetMap"
4041
- "MapQuest Open"
4142
- "MapQuest Open Aerial"
@@ -45,6 +46,7 @@ class Map(LegacyMap):
4546
- "Cloudmade" (Must pass API key)
4647
- "Mapbox" (Must pass API key)
4748
- "CartoDB" (positron and dark_matter)
49+
4850
You can pass a custom tileset to Folium by passing a Leaflet-style
4951
URL to the tiles parameter:
5052
http://{s}.yourtiles.com/{z}/{x}/{y}.png
@@ -77,15 +79,15 @@ class Map(LegacyMap):
7779
into pixel (screen) coordinates and back.
7880
You can use Leaflet's values :
7981
* EPSG3857 : The most common CRS for online maps, used by almost all
80-
free and commercial tile providers. Uses Spherical Mercator projection.
81-
Set in by default in Map's crs option.
82+
free and commercial tile providers. Uses Spherical Mercator projection.
83+
Set in by default in Map's crs option.
8284
* EPSG4326 : A common CRS among GIS enthusiasts. Uses simple Equirectangular
83-
projection.
85+
projection.
8486
* EPSG3395 : Rarely used by some commercial tile providers. Uses Elliptical
85-
Mercator projection.
87+
Mercator projection.
8688
* Simple : A simple CRS that maps longitude and latitude into x and y directly.
87-
May be used for maps of flat surfaces (e.g. game maps). Note that the y axis
88-
should still be inverted (going from bottom to top).
89+
May be used for maps of flat surfaces (e.g. game maps). Note that the y axis
90+
should still be inverted (going from bottom to top).
8991
9092
Returns
9193
-------
@@ -106,8 +108,8 @@ class Map(LegacyMap):
106108
def create_map(self, path='map.html', plugin_data_out=True, template=None):
107109
"""Write Map output to HTML.
108110
109-
Parameters:
110-
-----------
111+
Parameters
112+
----------
111113
path: string, default 'map.html'
112114
Path for HTML output for map
113115
plugin_data_out: boolean, default True
@@ -276,15 +278,15 @@ def multiline(self, locations, line_color=None, line_opacity=None,
276278
277279
Examples
278280
--------
279-
# FIXME: Add another example.
280281
>>> m.multiline(locations=[[(45.5236, -122.675), (45.5236, -122.675)],
281282
[(45.5237, -122.675), (45.5237, -122.675)],
282283
[(45.5238, -122.675), (45.5238, -122.675)]])
283284
>>> m.multiline(locations=[[(45.5236, -122.675), (45.5236, -122.675)],
284285
[(45.5237, -122.675), (45.5237, -122.675)],
285286
[(45.5238, -122.675), (45.5238, -122.675)]],
286-
line_color='red', line_weight=2,
287-
line_opacity=1.0)
287+
line_color='red', line_weight=2,
288+
line_opacity=1.0)
289+
FIXME: Add another example.
288290
"""
289291
warnings.warn("%s is deprecated. Use %s instead" %
290292
("multiline", "add_children(MultiPolyLine)"),

folium/map.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class LegacyMap(MacroElement):
2626
Generate a base map of given width and height with either default
2727
tilesets or a custom tileset URL. The following tilesets are built-in
2828
to Folium. Pass any of the following to the "tiles" keyword:
29+
2930
- "OpenStreetMap"
3031
- "MapQuest Open"
3132
- "MapQuest Open Aerial"
@@ -35,6 +36,7 @@ class LegacyMap(MacroElement):
3536
- "Cloudmade" (Must pass API key)
3637
- "Mapbox" (Must pass API key)
3738
- "CartoDB" (positron and dark_matter)
39+
3840
You can pass a custom tileset to Folium by passing a Leaflet-style
3941
URL to the tiles parameter:
4042
http://{s}.yourtiles.com/{z}/{x}/{y}.png
@@ -67,15 +69,15 @@ class LegacyMap(MacroElement):
6769
into pixel (screen) coordinates and back.
6870
You can use Leaflet's values :
6971
* EPSG3857 : The most common CRS for online maps, used by almost all
70-
free and commercial tile providers. Uses Spherical Mercator projection.
71-
Set in by default in Map's crs option.
72+
free and commercial tile providers. Uses Spherical Mercator projection.
73+
Set in by default in Map's crs option.
7274
* EPSG4326 : A common CRS among GIS enthusiasts. Uses simple Equirectangular
73-
projection.
75+
projection.
7476
* EPSG3395 : Rarely used by some commercial tile providers. Uses Elliptical
75-
Mercator projection.
77+
Mercator projection.
7678
* Simple : A simple CRS that maps longitude and latitude into x and y directly.
77-
May be used for maps of flat surfaces (e.g. game maps). Note that the y axis
78-
should still be inverted (going from bottom to top).
79+
May be used for maps of flat surfaces (e.g. game maps). Note that the y axis
80+
should still be inverted (going from bottom to top).
7981
8082
Returns
8183
-------
@@ -229,6 +231,7 @@ class TileLayer(Layer):
229231
- "Cloudmade" (Must pass API key)
230232
- "Mapbox" (Must pass API key)
231233
- "CartoDB" (positron and dark_matter)
234+
232235
You can pass a custom tileset to Folium by passing a Leaflet-style
233236
URL to the tiles parameter:
234237
http://{s}.yourtiles.com/{z}/{x}/{y}.png
@@ -381,18 +384,20 @@ class Icon(MacroElement):
381384
----------
382385
color : str, default 'blue'
383386
The color of the marker. You can use:
387+
384388
['red', 'blue', 'green', 'purple', 'orange', 'darkred',
385389
'lightred', 'beige', 'darkblue', 'darkgreen', 'cadetblue',
386390
'darkpurple', 'white', 'pink', 'lightblue', 'lightgreen',
387391
'gray', 'black', 'lightgray']
392+
388393
icon_color : str, default 'white'
389394
The color of the drawing on the marker. You can use colors above,
390395
or an html color code.
391396
icon : str, default 'info-sign'
392397
The name of the marker sign.
393398
See Font-Awesome website to choose yours.
394399
Warning : depending on the icon you choose you may need to adapt
395-
the `prefix` as well.
400+
the `prefix` as well.
396401
angle : int, default 0
397402
The icon will be rotated by this amount of degrees.
398403
prefix : str, default 'glyphicon'

0 commit comments

Comments
 (0)