88
99
1010class Document (Generator ):
11-
1211 """An HTML document.
1312
1413 A document consists of a doctype declaration and the HTML root tag.
@@ -34,11 +33,10 @@ class Document(Generator):
3433 >>> doc.add_script("my-script.js")
3534 >>> doc.add_stylesheet("style.css")
3635 >>> doc.append_body(Element("div"))
37-
3836 """
3937
4038 def __init__ (self , title = None , language = "en" ):
41- super (Document , self ).__init__ ()
39+ super ().__init__ ()
4240 self .root = HTMLRoot (title = title , language = language )
4341
4442 def generate (self ):
@@ -73,7 +71,6 @@ def append_body(self, child):
7371
7472
7573class HTMLRoot (NonVoidElement ):
76-
7774 """HTML root (<html>) element.
7875
7976 >>> root = HTMLRoot(title="My Page")
@@ -85,11 +82,10 @@ class HTMLRoot(NonVoidElement):
8582
8683 >>> root.head = Head()
8784 >>> root.body = Body()
88-
8985 """
9086
9187 def __init__ (self , title = "" , language = "en" ):
92- super (HTMLRoot , self ).__init__ ("html" )
88+ super ().__init__ ("html" )
9389 self .head = Head (title = title )
9490 self .body = Body ()
9591 self .set_attribute ("xmlns" , "http://www.w3.org/1999/xhtml" )
@@ -102,7 +98,6 @@ def generate_children(self):
10298
10399
104100class Head (Element ):
105-
106101 """HTML document head (<head>) element.
107102
108103 A title element is provided by default, but it can be overwritten:
@@ -116,11 +111,10 @@ class Head(Element):
116111
117112 >>> head.add_stylesheet("style.css")
118113 >>> head.add_script("script.js")
119-
120114 """
121115
122116 def __init__ (self , title = None ):
123- super (Head , self ).__init__ ("head" )
117+ super ().__init__ ("head" )
124118 self ._title = Title (title )
125119 self .append (self ._title )
126120 self .append (Meta .create_charset ("utf-8" ))
@@ -151,19 +145,17 @@ def add_script(self, script):
151145
152146
153147class Body (Element ):
154-
155148 """HTML body (<body>) element."""
156149
157150 def __init__ (self ):
158- super (Body , self ).__init__ ("body" )
151+ super ().__init__ ("body" )
159152
160153
161154class Title (NonVoidElement ):
162-
163155 """HTML page title (<title>) element."""
164156
165157 def __init__ (self , title = None ):
166- super (Title , self ).__init__ ("title" )
158+ super ().__init__ ("title" )
167159 self .title = title or ""
168160
169161 def generate_children (self ):
@@ -172,11 +164,10 @@ def generate_children(self):
172164
173165
174166class Meta (VoidElement ):
175-
176167 """HTML meta information (<meta>) element."""
177168
178169 def __init__ (self ):
179- super (Meta , self ).__init__ ("meta" )
170+ super ().__init__ ("meta" )
180171
181172 @classmethod
182173 def create_charset (cls , charset ):
@@ -186,7 +177,6 @@ def create_charset(cls, charset):
186177
187178
188179class Script (NonVoidElement ):
189-
190180 """HTML script (<script>) element.
191181
192182 A script element can either point to an external script via the url
@@ -210,12 +200,11 @@ class Script(NonVoidElement):
210200
211201 >>> Script().type
212202 'text/javascript'
213-
214203 """
215204
216205 def __init__ (self , url = None , script = None ):
217206 assert url is None or script is None
218- super (Script , self ).__init__ ("script" )
207+ super ().__init__ ("script" )
219208 if url :
220209 self .url = url
221210 self .script = script
@@ -249,11 +238,10 @@ def json_script(json):
249238
250239
251240class HeadLink (VoidElement ):
252-
253241 """HTML meta data link (<link>) element."""
254242
255243 def __init__ (self , relation , url ):
256- super (HeadLink , self ).__init__ ("link" )
244+ super ().__init__ ("link" )
257245 self .relation = relation
258246 self .url = url
259247
@@ -266,8 +254,7 @@ def create_stylesheet(cls, stylesheet):
266254
267255
268256class Main (Element ):
269-
270257 """HTML main document content (<main>) element."""
271258
272259 def __init__ (self ):
273- super (Main , self ).__init__ ("main" )
260+ super ().__init__ ("main" )
0 commit comments