Skip to content

Commit 794c473

Browse files
author
Martin Journois
committed
Docstring review in element.py
1 parent 81903fd commit 794c473

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.")
@@ -566,13 +582,14 @@ class MacroElement(Element):
566582
{% endmacro %}
567583
"""
568584
def __init__(self):
569-
"""TODO : docstring here"""
585+
"""Creates a MacroElement object."""
570586
super(MacroElement, self).__init__()
571587
self._name = 'MacroElement'
572588

573589
self._template = Template(u"")
574590

575591
def render(self, **kwargs):
592+
"""Renders the Element into an HTML representation."""
576593
figure = self.get_root()
577594
assert isinstance(figure, Figure), ("You cannot render this Element "
578595
"if it's not in a Figure.")

0 commit comments

Comments
 (0)