Skip to content

Commit 3d54633

Browse files
authored
Merge pull request #446 from ocefpaf/fix_warnings
Fix warnings
2 parents bf4cf2e + 30a17c1 commit 3d54633

17 files changed

+95
-95
lines changed

folium/features.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def render(self, **kwargs):
158158
assert isinstance(figure, Figure), ("You cannot render this Element "
159159
"if it's not in a Figure.")
160160

161-
figure.header.add_children(
161+
figure.header.add_child(
162162
JavascriptLink("https://cdnjs.cloudflare.com/ajax/libs/leaflet-dvf/0.2/leaflet-dvf.markers.min.js"), # noqa
163163
name='dvf_js')
164164

@@ -213,19 +213,19 @@ def render(self, **kwargs):
213213
"""Renders the HTML representation of the element."""
214214
self.json = json.dumps(self.data)
215215

216-
self._parent.html.add_children(Element(Template("""
216+
self._parent.html.add_child(Element(Template("""
217217
<div id="{{this.get_name()}}"></div>
218218
""").render(this=self, kwargs=kwargs)), name=self.get_name())
219219

220-
self._parent.script.add_children(Element(Template("""
220+
self._parent.script.add_child(Element(Template("""
221221
vega_parse({{this.json}},{{this.get_name()}});
222222
""").render(this=self)), name=self.get_name())
223223

224224
figure = self.get_root()
225225
assert isinstance(figure, Figure), ("You cannot render this Element "
226226
"if it's not in a Figure.")
227227

228-
figure.header.add_children(Element(Template("""
228+
figure.header.add_child(Element(Template("""
229229
<style> #{{this.get_name()}} {
230230
position : {{this.position}};
231231
width : {{this.width[0]}}{{this.width[1]}};
@@ -235,19 +235,19 @@ def render(self, **kwargs):
235235
</style>
236236
""").render(this=self, **kwargs)), name=self.get_name())
237237

238-
figure.header.add_children(
238+
figure.header.add_child(
239239
JavascriptLink("https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"), # noqa
240240
name='d3')
241241

242-
figure.header.add_children(
242+
figure.header.add_child(
243243
JavascriptLink("https://cdnjs.cloudflare.com/ajax/libs/vega/1.4.3/vega.min.js"), # noqa
244244
name='vega')
245245

246-
figure.header.add_children(
246+
figure.header.add_child(
247247
JavascriptLink("https://code.jquery.com/jquery-2.1.0.min.js"),
248248
name='jquery')
249249

250-
figure.script.add_children(
250+
figure.script.add_child(
251251
Template("""function vega_parse(spec, div) {
252252
vg.parse.spec(spec, function(chart) { chart({el:div}).update(); });}"""), # noqa
253253
name='vega_parse')
@@ -499,7 +499,7 @@ def render(self, **kwargs):
499499
assert isinstance(figure, Figure), ("You cannot render this Element "
500500
"if it's not in a Figure.")
501501

502-
figure.header.add_children(
502+
figure.header.add_child(
503503
JavascriptLink("https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.9/topojson.min.js"), # noqa
504504
name='topojson')
505505

@@ -536,7 +536,7 @@ def _get_self_bounds(self):
536536

537537
class MarkerCluster(Layer):
538538
"""Creates a MarkerCluster element to append into a map with
539-
Map.add_children.
539+
Map.add_child.
540540
541541
Parameters
542542
----------
@@ -565,19 +565,19 @@ def render(self, **kwargs):
565565
figure = self.get_root()
566566
assert isinstance(figure, Figure), ("You cannot render this Element "
567567
"if it's not in a Figure.")
568-
figure.header.add_children(
568+
figure.header.add_child(
569569
JavascriptLink("https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/0.4.0/leaflet.markercluster-src.js"), # noqa
570570
name='marker_cluster_src')
571571

572-
figure.header.add_children(
572+
figure.header.add_child(
573573
JavascriptLink("https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/0.4.0/leaflet.markercluster.js"), # noqa
574574
name='marker_cluster')
575575

576-
figure.header.add_children(
576+
figure.header.add_child(
577577
CssLink("https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/0.4.0/MarkerCluster.css"), # noqa
578578
name='marker_cluster_css')
579579

580-
figure.header.add_children(
580+
figure.header.add_child(
581581
CssLink("https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/0.4.0/MarkerCluster.Default.css"), # noqa
582582
name="marker_cluster_default_css")
583583

@@ -740,7 +740,7 @@ def __init__(self, popup=None):
740740
class PolyLine(MacroElement):
741741
"""
742742
Creates a PolyLine object to append into a map with
743-
Map.add_children.
743+
Map.add_child.
744744
745745
Parameters
746746
----------
@@ -767,9 +767,9 @@ def __init__(self, locations, color=None, weight=None,
767767
self.weight = weight
768768
self.opacity = opacity
769769
if isinstance(popup, text_type) or isinstance(popup, binary_type):
770-
self.add_children(Popup(popup))
770+
self.add_child(Popup(popup))
771771
elif popup is not None:
772-
self.add_children(popup)
772+
self.add_child(popup)
773773

774774
self._template = Template(u"""
775775
{% macro script(this, kwargs) %}
@@ -806,7 +806,7 @@ def _get_self_bounds(self):
806806
class MultiPolyLine(MacroElement):
807807
"""
808808
Creates a MultiPolyLine object to append into a map with
809-
Map.add_children.
809+
Map.add_child.
810810
811811
Parameters
812812
----------
@@ -833,9 +833,9 @@ def __init__(self, locations, color=None, weight=None,
833833
self.weight = weight
834834
self.opacity = opacity
835835
if isinstance(popup, text_type) or isinstance(popup, binary_type):
836-
self.add_children(Popup(popup))
836+
self.add_child(Popup(popup))
837837
elif popup is not None:
838-
self.add_children(popup)
838+
self.add_child(popup)
839839

840840
self._template = Template(u"""
841841
{% macro script(this, kwargs) %}

folium/folium.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def add_wms_layer(self, wms_name=None, wms_url=None, wms_format=None,
145145
wms = WmsTileLayer(wms_url, name=wms_name, format=wms_format,
146146
layers=wms_layers, transparent=wms_transparent,
147147
attr=None)
148-
self.add_children(wms, name=wms_name)
148+
self.add_child(wms, name=wms_name)
149149

150150
def simple_marker(self, location=None, popup=None,
151151
marker_color='blue', marker_icon='info-sign',
@@ -203,7 +203,7 @@ def simple_marker(self, location=None, popup=None,
203203
icon=Icon(color=marker_color,
204204
icon=marker_icon,
205205
angle=icon_angle))
206-
self.add_children(marker)
206+
self.add_child(marker)
207207

208208
def line(self, locations,
209209
line_color=None, line_opacity=None, line_weight=None,
@@ -249,9 +249,9 @@ def line(self, locations,
249249
)
250250

251251
if popup is not None:
252-
p.add_children(Popup(popup, max_width=popup_width))
252+
p.add_child(Popup(popup, max_width=popup_width))
253253

254-
self.add_children(p)
254+
self.add_child(p)
255255

256256
def multiline(self, locations, line_color=None, line_opacity=None,
257257
line_weight=None, popup=None, popup_width=300, latlon=True):
@@ -303,9 +303,9 @@ def multiline(self, locations, line_color=None, line_opacity=None,
303303
latlon=latlon)
304304

305305
if popup is not None:
306-
p.add_children(Popup(popup, max_width=popup_width))
306+
p.add_child(Popup(popup, max_width=popup_width))
307307

308-
self.add_children(p)
308+
self.add_child(p)
309309

310310
def circle_marker(self, location=None, radius=500, popup=None,
311311
line_color='black', fill_color='black',
@@ -360,7 +360,7 @@ def circle_marker(self, location=None, radius=500, popup=None,
360360
fill_color=fill_color,
361361
fill_opacity=fill_opacity,
362362
popup=popup_)
363-
self.add_children(marker)
363+
self.add_child(marker)
364364

365365
def polygon_marker(self, location=None, line_color='black', line_opacity=1,
366366
line_weight=2, fill_color='blue', fill_opacity=1,
@@ -421,14 +421,14 @@ def polygon_marker(self, location=None, line_color='black', line_opacity=1,
421421
number_of_sides=num_sides,
422422
rotation=rotation,
423423
radius=radius)
424-
self.add_children(marker)
424+
self.add_child(marker)
425425

426426
def lat_lng_popover(self):
427427
"""Enable popovers to display Lat and Lon on each click."""
428428
warnings.warn("%s is deprecated. Use %s instead" %
429429
("lat_lng_popover", "add_children(LatLngPopup)"),
430430
FutureWarning, stacklevel=2)
431-
self.add_children(LatLngPopup())
431+
self.add_child(LatLngPopup())
432432

433433
def click_for_marker(self, popup=None):
434434
"""Enable the addition of markers via clicking on the map. The marker
@@ -448,7 +448,7 @@ def click_for_marker(self, popup=None):
448448
warnings.warn("%s is deprecated. Use %s instead" %
449449
("click_for_marker", "add_children(ClickForMarker)"),
450450
FutureWarning, stacklevel=2)
451-
self.add_children(ClickForMarker(popup=popup))
451+
self.add_child(ClickForMarker(popup=popup))
452452

453453
def fit_bounds(self, bounds, padding_top_left=None,
454454
padding_bottom_right=None, padding=None, max_zoom=None):
@@ -476,13 +476,13 @@ def fit_bounds(self, bounds, padding_top_left=None,
476476
>>> map.fit_bounds([[52.193636, -2.221575], [52.636878, -1.139759]])
477477
478478
"""
479-
self.add_children(FitBounds(bounds,
480-
padding_top_left=padding_top_left,
481-
padding_bottom_right=padding_bottom_right,
482-
padding=padding,
483-
max_zoom=max_zoom,
484-
)
485-
)
479+
self.add_child(FitBounds(bounds,
480+
padding_top_left=padding_top_left,
481+
padding_bottom_right=padding_bottom_right,
482+
padding=padding,
483+
max_zoom=max_zoom,
484+
)
485+
)
486486

487487
def add_plugin(self, plugin):
488488
"""Adds a plugin to the map.
@@ -496,7 +496,7 @@ def add_plugin(self, plugin):
496496
warnings.warn("%s is deprecated. Use %s instead" %
497497
("add_plugin", "add_children"),
498498
FutureWarning, stacklevel=2)
499-
self.add_children(plugin)
499+
self.add_child(plugin)
500500

501501
def geo_json(self, *args, **kwargs):
502502
"""This method is deprecated and will be removed in v0.2.1. See
@@ -690,7 +690,7 @@ def style_function(x):
690690
style_function=style_function,
691691
smooth_factor=smooth_factor)
692692

693-
self.add_children(geo_json)
693+
self.add_child(geo_json)
694694

695695
# Create ColorMap.
696696
if color_domain:
@@ -701,7 +701,7 @@ def style_function(x):
701701
vmin=color_domain[0],
702702
vmax=color_domain[-1],
703703
)
704-
self.add_children(color_scale)
704+
self.add_child(color_scale)
705705

706706
def image_overlay(self, data, opacity=0.25, min_lat=-90.0, max_lat=90.0,
707707
min_lon=-180.0, max_lon=180.0, origin='upper',
@@ -782,9 +782,9 @@ def image_overlay(self, data, opacity=0.25, min_lat=-90.0, max_lat=90.0,
782782
open(filename, 'wb').write(image)
783783
data = filename
784784

785-
self.add_children(ImageOverlay(data, [[min_lat, min_lon],
786-
[max_lat, max_lon]],
787-
opacity=opacity,
788-
origin=origin,
789-
colormap=colormap,
790-
mercator_project=mercator_project))
785+
self.add_child(ImageOverlay(data, [[min_lat, min_lon],
786+
[max_lat, max_lon]],
787+
opacity=opacity,
788+
origin=origin,
789+
colormap=colormap,
790+
mercator_project=mercator_project))

folium/map.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def __init__(self, location=None, width='100%', height='100%',
150150
self.location = location
151151
self.zoom_start = zoom_start
152152

153-
Figure().add_children(self)
153+
Figure().add_child(self)
154154

155155
# Map Size Parameters.
156156
self.width = _parse_size(width)
@@ -233,7 +233,7 @@ def add_tile_layer(self, tiles='OpenStreetMap', name=None,
233233
min_zoom=min_zoom, max_zoom=max_zoom,
234234
attr=attr, API_key=API_key,
235235
detect_retina=detect_retina)
236-
self.add_children(tile_layer, name=tile_layer.tile_name)
236+
self.add_child(tile_layer, name=tile_layer.tile_name)
237237

238238
def render(self, **kwargs):
239239
"""Renders the HTML representation of the element."""
@@ -243,13 +243,13 @@ def render(self, **kwargs):
243243

244244
# Import Javascripts
245245
for name, url in _default_js:
246-
figure.header.add_children(JavascriptLink(url), name=name)
246+
figure.header.add_child(JavascriptLink(url), name=name)
247247

248248
# Import Css
249249
for name, url in _default_css:
250-
figure.header.add_children(CssLink(url), name=name)
250+
figure.header.add_child(CssLink(url), name=name)
251251

252-
figure.header.add_children(Element(
252+
figure.header.add_child(Element(
253253
'<style>html, body {'
254254
'width: 100%;'
255255
'height: 100%;'
@@ -258,7 +258,7 @@ def render(self, **kwargs):
258258
'}'
259259
'</style>'), name='css_style')
260260

261-
figure.header.add_children(Element(
261+
figure.header.add_child(Element(
262262
'<style>#map {'
263263
'position:absolute;'
264264
'top:0;'
@@ -537,11 +537,11 @@ def __init__(self, location, popup=None, icon=None):
537537
self._name = 'Marker'
538538
self.location = location
539539
if icon is not None:
540-
self.add_children(icon)
540+
self.add_child(icon)
541541
if isinstance(popup, text_type) or isinstance(popup, binary_type):
542-
self.add_children(Popup(popup))
542+
self.add_child(Popup(popup))
543543
elif popup is not None:
544-
self.add_children(popup)
544+
self.add_child(popup)
545545

546546
self._template = Template(u"""
547547
{% macro script(this, kwargs) %}
@@ -586,9 +586,9 @@ def __init__(self, html=None, max_width=300):
586586
self.script._parent = self
587587

588588
if isinstance(html, Element):
589-
self.html.add_children(html)
589+
self.html.add_child(html)
590590
elif isinstance(html, text_type) or isinstance(html, binary_type):
591-
self.html.add_children(Html(text_type(html)))
591+
self.html.add_child(Html(text_type(html)))
592592

593593
self.max_width = max_width
594594

@@ -616,7 +616,7 @@ def render(self, **kwargs):
616616
assert isinstance(figure, Figure), ("You cannot render this Element "
617617
"if it's not in a Figure.")
618618

619-
figure.script.add_children(Element(
619+
figure.script.add_child(Element(
620620
self._template.render(this=self, kwargs=kwargs)),
621621
name=self.get_name())
622622

folium/plugins/boat_marker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ def render(self, **kwargs):
6060
assert isinstance(figure, Figure), ("You cannot render this Element "
6161
"if it's not in a Figure.")
6262

63-
figure.header.add_children(
63+
figure.header.add_child(
6464
JavascriptLink("https://thomasbrueggemann.github.io/leaflet.boatmarker/js/leaflet.boatmarker.min.js"), # noqa
6565
name='markerclusterjs')

folium/plugins/fullscreen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ def render(self, **kwargs):
3939
assert isinstance(figure, Figure), ("You cannot render this Element "
4040
"if it's not in a Figure.")
4141

42-
figure.header.add_children(
42+
figure.header.add_child(
4343
JavascriptLink(
4444
"https://cdnjs.cloudflare.com/ajax/libs/leaflet.fullscreen/1.4.2/Control.FullScreen.min.js"), # noqa
4545
name='Control.Fullscreen.js'
4646
)
4747

48-
figure.header.add_children(
48+
figure.header.add_child(
4949
CssLink("https://cdnjs.cloudflare.com/ajax/libs/leaflet.fullscreen/1.4.2/Control.FullScreen.min.css"), # noqa
5050
name='Control.FullScreen.css'
5151
)

folium/plugins/heat_map.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def render(self, **kwargs):
7878
assert isinstance(figure, Figure), ("You cannot render this Element "
7979
"if it's not in a Figure.")
8080

81-
figure.header.add_children(
81+
figure.header.add_child(
8282
JavascriptLink("https://leaflet.github.io/Leaflet.heat/dist/leaflet-heat.js"), # noqa
8383
name='leaflet-heat.js')
8484

0 commit comments

Comments
 (0)