@@ -81,16 +81,14 @@ class RegularPolygonMarker(JSCSSMixin, Marker):
8181
8282 """
8383
84- _template = Template (
85- """
84+ _template = Template ("""
8685 {% macro script(this, kwargs) %}
8786 var {{ this.get_name() }} = new L.RegularPolygonMarker(
8887 {{ this.location|tojson }},
8988 {{ this.options|tojavascript }}
9089 ).addTo({{ this._parent.get_name() }});
9190 {% endmacro %}
92- """
93- )
91+ """ )
9492
9593 default_js = [
9694 (
@@ -191,24 +189,16 @@ def render(self, **kwargs):
191189 self .json = json .dumps (self .data )
192190
193191 self ._parent .html .add_child (
194- Element (
195- Template (
196- """
192+ Element (Template ("""
197193 <div id="{{this.get_name()}}"></div>
198- """
199- ).render (this = self , kwargs = kwargs )
200- ),
194+ """ ).render (this = self , kwargs = kwargs )),
201195 name = self .get_name (),
202196 )
203197
204198 self ._parent .script .add_child (
205- Element (
206- Template (
207- """
199+ Element (Template ("""
208200 vega_parse({{this.json}},{{this.get_name()}});
209- """
210- ).render (this = self )
211- ),
201+ """ ).render (this = self )),
212202 name = self .get_name (),
213203 )
214204
@@ -218,19 +208,15 @@ def render(self, **kwargs):
218208 ), "You cannot render this Element if it is not in a Figure."
219209
220210 figure .header .add_child (
221- Element (
222- Template (
223- """
211+ Element (Template ("""
224212 <style> #{{this.get_name()}} {
225213 position : {{this.position}};
226214 width : {{this.width[0]}}{{this.width[1]}};
227215 height: {{this.height[0]}}{{this.height[1]}};
228216 left: {{this.left[0]}}{{this.left[1]}};
229217 top: {{this.top[0]}}{{this.top[1]}};
230218 </style>
231- """
232- ).render (this = self , ** kwargs )
233- ),
219+ """ ).render (this = self , ** kwargs )),
234220 name = self .get_name (),
235221 )
236222
@@ -312,13 +298,9 @@ def render(self, **kwargs):
312298 )
313299
314300 parent .html .add_child (
315- Element (
316- Template (
317- """
301+ Element (Template ("""
318302 <div id="{{this.get_name()}}"></div>
319- """
320- ).render (this = self , kwargs = kwargs )
321- ),
303+ """ ).render (this = self , kwargs = kwargs )),
322304 name = self .get_name (),
323305 )
324306
@@ -328,19 +310,15 @@ def render(self, **kwargs):
328310 ), "You cannot render this Element if it is not in a Figure."
329311
330312 figure .header .add_child (
331- Element (
332- Template (
333- """
313+ Element (Template ("""
334314 <style> #{{this.get_name()}} {
335315 position : {{this.position}};
336316 width : {{this.width[0]}}{{this.width[1]}};
337317 height: {{this.height[0]}}{{this.height[1]}};
338318 left: {{this.left[0]}}{{this.left[1]}};
339319 top: {{this.top[0]}}{{this.top[1]}};
340320 </style>
341- """
342- ).render (this = self , ** kwargs )
343- ),
321+ """ ).render (this = self , ** kwargs )),
344322 name = self .get_name (),
345323 )
346324
@@ -440,33 +418,25 @@ def _embed_vegalite_v2(self, figure: Figure, parent: TypeContainer) -> None:
440418
441419 def _vega_embed (self , parent : TypeContainer ) -> None :
442420 parent .script .add_child (
443- Element (
444- Template (
445- """
421+ Element (Template ("""
446422 vegaEmbed({{this.get_name()}}, {{this.json}})
447423 .then(function(result) {})
448424 .catch(console.error);
449- """
450- ).render (this = self )
451- ),
425+ """ ).render (this = self )),
452426 name = self .get_name (),
453427 )
454428
455429 def _embed_vegalite_v1 (self , figure : Figure , parent : TypeContainer ) -> None :
456430 parent .script .add_child (
457- Element (
458- Template (
459- """
431+ Element (Template ("""
460432 var embedSpec = {
461433 mode: "vega-lite",
462434 spec: {{this.json}}
463435 };
464436 vg.embed(
465437 {{this.get_name()}}, embedSpec, function(error, result) {}
466438 );
467- """
468- ).render (this = self )
469- ),
439+ """ ).render (this = self )),
470440 name = self .get_name (),
471441 )
472442
@@ -568,8 +538,7 @@ class GeoJson(Layer):
568538
569539 """
570540
571- _template = Template (
572- """
541+ _template = Template ("""
573542 {% macro script(this, kwargs) %}
574543 {%- if this.style %}
575544 function {{ this.get_name() }}_styler(feature) {
@@ -693,8 +662,7 @@ class GeoJson(Layer):
693662 {%- endif %}
694663
695664 {% endmacro %}
696- """
697- ) # noqa
665+ """ ) # noqa
698666
699667 def __init__ (
700668 self ,
@@ -1006,8 +974,7 @@ class TopoJson(JSCSSMixin, Layer):
1006974
1007975 """
1008976
1009- _template = Template (
1010- """
977+ _template = Template ("""
1011978 {% macro script(this, kwargs) %}
1012979 var {{ this.get_name() }}_data = {{ this.data|tojson }};
1013980 var {{ this.get_name() }} = L.geoJson(
@@ -1025,8 +992,7 @@ class TopoJson(JSCSSMixin, Layer):
1025992 return feature.properties.style;
1026993 });
1027994 {% endmacro %}
1028- """
1029- ) # noqa
995+ """ ) # noqa
1030996
1031997 default_js = [
1032998 (
@@ -1247,9 +1213,7 @@ def render(self, **kwargs):
12471213 value in keys
12481214 ), f"The field { value } is not available in the data. Choose from: { keys } ."
12491215 figure .header .add_child (
1250- Element (
1251- Template (
1252- """
1216+ Element (Template ("""
12531217 <style>
12541218 .{{ this.class_name }} {
12551219 {{ this.style }}
@@ -1264,9 +1228,7 @@ def render(self, **kwargs):
12641228 padding: 2px; padding-right: 8px;
12651229 }
12661230 </style>
1267- """
1268- ).render (this = self )
1269- ),
1231+ """ ).render (this = self )),
12701232 name = self .get_name () + "tablestyle" ,
12711233 )
12721234
@@ -1756,13 +1718,11 @@ class DivIcon(MacroElement):
17561718
17571719 """
17581720
1759- _template = Template (
1760- """
1721+ _template = Template ("""
17611722 {% macro script(this, kwargs) %}
17621723 var {{ this.get_name() }} = L.divIcon({{ this.options|tojavascript }});
17631724 {% endmacro %}
1764- """
1765- ) # noqa
1725+ """ ) # noqa
17661726
17671727 def __init__ (
17681728 self ,
@@ -1790,8 +1750,7 @@ class LatLngPopup(MacroElement):
17901750
17911751 """
17921752
1793- _template = Template (
1794- """
1753+ _template = Template ("""
17951754 {% macro script(this, kwargs) %}
17961755 var {{this.get_name()}} = L.popup();
17971756 function latLngPop(e) {
@@ -1803,8 +1762,7 @@ class LatLngPopup(MacroElement):
18031762 }
18041763 {{this._parent.get_name()}}.on('click', latLngPop);
18051764 {% endmacro %}
1806- """
1807- ) # noqa
1765+ """ ) # noqa
18081766
18091767 def __init__ (self ):
18101768 super ().__init__ ()
@@ -1831,8 +1789,7 @@ class ClickForMarker(MacroElement):
18311789
18321790 """
18331791
1834- _template = Template (
1835- """
1792+ _template = Template ("""
18361793 {% macro script(this, kwargs) %}
18371794 function newMarker(e){
18381795 var new_mark = L.marker().setLatLng(e.latlng).addTo({{this._parent.get_name()}});
@@ -1844,8 +1801,7 @@ class ClickForMarker(MacroElement):
18441801 };
18451802 {{this._parent.get_name()}}.on('click', newMarker);
18461803 {% endmacro %}
1847- """
1848- ) # noqa
1804+ """ ) # noqa
18491805
18501806 def __init__ (self , popup : Union [IFrame , Html , str , None ] = None ):
18511807 super ().__init__ ()
@@ -1875,8 +1831,7 @@ class ClickForLatLng(MacroElement):
18751831 Whether there should be an alert when something has been copied to clipboard.
18761832 """
18771833
1878- _template = Template (
1879- """
1834+ _template = Template ("""
18801835 {% macro script(this, kwargs) %}
18811836 function getLatLng(e){
18821837 var lat = e.latlng.lat.toFixed(6),
@@ -1887,8 +1842,7 @@ class ClickForLatLng(MacroElement):
18871842 };
18881843 {{this._parent.get_name()}}.on('click', getLatLng);
18891844 {% endmacro %}
1890- """
1891- ) # noqa
1845+ """ ) # noqa
18921846
18931847 def __init__ (self , format_str : Optional [str ] = None , alert : bool = True ):
18941848 super ().__init__ ()
@@ -1932,13 +1886,11 @@ class CustomIcon(Icon):
19321886
19331887 """
19341888
1935- _template = Template (
1936- """
1889+ _template = Template ("""
19371890 {% macro script(this, kwargs) %}
19381891 var {{ this.get_name() }} = L.icon({{ this.options|tojavascript }});
19391892 {% endmacro %}
1940- """
1941- ) # noqa
1893+ """ ) # noqa
19421894
19431895 def __init__ (
19441896 self ,
@@ -2058,8 +2010,7 @@ class Control(JSCSSMixin, Class):
20582010 >>> Control("Zoom", position="topleft").add_to(m)
20592011 """
20602012
2061- _template = Template (
2062- """
2013+ _template = Template ("""
20632014 {% macro script(this, kwargs) %}
20642015 var {{ this.get_name() }} = new L.Control.{{this._name}}(
20652016 {% for arg in this.args %}
@@ -2068,8 +2019,7 @@ class Control(JSCSSMixin, Class):
20682019 {{ this.options|tojavascript }}
20692020 ).addTo({{ this._parent.get_name() }});
20702021 {% endmacro %}
2071- """
2072- )
2022+ """ )
20732023
20742024 def __init__ (
20752025 self ,
0 commit comments