diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py
index 2e7958325cd..440181a7611 100644
--- a/src/etc/htmldocck.py
+++ b/src/etc/htmldocck.py
@@ -125,8 +125,8 @@ except ImportError:
from htmlentitydefs import name2codepoint
# "void elements" (no closing tag) from the HTML Standard section 12.1.2
-VOID_ELEMENTS = set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen',
- 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'])
+VOID_ELEMENTS = {'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen',
+ 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'}
# Python 2 -> 3 compatibility
try:
@@ -146,7 +146,7 @@ class CustomHTMLParser(HTMLParser):
self.__builder = target or ET.TreeBuilder()
def handle_starttag(self, tag, attrs):
- attrs = dict((k, v or '') for k, v in attrs)
+ attrs = {k: v or '' for k, v in attrs}
self.__builder.start(tag, attrs)
if tag in VOID_ELEMENTS:
self.__builder.end(tag)
@@ -155,7 +155,7 @@ class CustomHTMLParser(HTMLParser):
self.__builder.end(tag)
def handle_startendtag(self, tag, attrs):
- attrs = dict((k, v or '') for k, v in attrs)
+ attrs = {k: v or '' for k, v in attrs}
self.__builder.start(tag, attrs)
self.__builder.end(tag)