Skip to content

Commit add5f86

Browse files
author
Martin Journois
committed
Docstring review in element.py
1 parent 6c2c96f commit add5f86

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

folium/element.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ def get_root(self):
107107
return self._parent.get_root()
108108

109109
def render(self, **kwargs):
110-
"""TODO : docstring here."""
110+
"""Renders the Element into an HTML representation, using the `_template`
111+
attribute.
112+
"""
111113
return self._template.render(this=self, kwargs=kwargs)
112114

113115
def save(self, outfile, close_file=True, **kwargs):
@@ -325,7 +327,7 @@ def get_root(self):
325327
return self
326328

327329
def render(self, **kwargs):
328-
"""TODO : docstring here."""
330+
"""Renders the Element into an HTML representation."""
329331
for name, child in self._children.items():
330332
child.render(**kwargs)
331333
return self._template.render(this=self, kwargs=kwargs)
@@ -378,8 +380,22 @@ def add_subplot(self, x, y, n, margin=0.05):
378380

379381

380382
class Html(Element):
383+
"""A basic Element for embedding HTML.
384+
"""
381385
def __init__(self, data, width="100%", height="100%"):
382-
"""TODO : docstring here"""
386+
"""Create an HTML div object for embedding data.
387+
388+
Parameters
389+
----------
390+
data : str
391+
The HTML data to be embedded.
392+
width : int or str, default '100%'
393+
The width of the output div.
394+
Ex : 120 , '120px', '80%'
395+
height : int or str, default '100%'
396+
The height of the output div.
397+
Ex : 120 , '120px', '80%'
398+
"""
383399
super(Html, self).__init__()
384400
self._name = 'Html'
385401
self.data = data
@@ -441,7 +457,7 @@ def get_root(self):
441457
return self
442458

443459
def render(self, **kwargs):
444-
"""TODO : docstring here."""
460+
"""Renders the Element into an HTML representation."""
445461
figure = self._parent
446462
assert isinstance(figure, Figure), ("You cannot render this Element "
447463
"if it's not in a Figure.")
@@ -563,13 +579,14 @@ class MacroElement(Element):
563579
{% endmacro %}
564580
"""
565581
def __init__(self):
566-
"""TODO : docstring here"""
582+
"""Creates a MacroElement object."""
567583
super(MacroElement, self).__init__()
568584
self._name = 'MacroElement'
569585

570586
self._template = Template(u"")
571587

572588
def render(self, **kwargs):
589+
"""Renders the Element into an HTML representation."""
573590
figure = self.get_root()
574591
assert isinstance(figure, Figure), ("You cannot render this Element "
575592
"if it's not in a Figure.")

0 commit comments

Comments
 (0)