Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion html5lib/_inputstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def charsUntil(self, characters, opposite=False):
except KeyError:
if __debug__:
for c in characters:
assert(ord(c) < 128)
assert ord(c) < 128
regex = "".join(["\\x%02x" % ord(c) for c in characters])
if not opposite:
regex = "^%s" % regex
Expand Down
4 changes: 2 additions & 2 deletions html5lib/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,14 @@ def __init__(self, **kwargs):
self.strict = False

def encode(self, string):
assert(isinstance(string, text_type))
assert isinstance(string, text_type)
if self.encoding:
return string.encode(self.encoding, "htmlentityreplace")
else:
return string

def encodeStrict(self, string):
assert(isinstance(string, text_type))
assert isinstance(string, text_type)
if self.encoding:
return string.encode(self.encoding, "strict")
else:
Expand Down
2 changes: 1 addition & 1 deletion html5lib/tests/test_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _convertAttrib(self, attribs):
attrs = {}
for attrib in attribs:
name = (attrib["namespace"], attrib["name"])
assert(name not in attrs)
assert name not in attrs
attrs[name] = attrib["value"]
return attrs

Expand Down
4 changes: 2 additions & 2 deletions html5lib/treebuilders/etree.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def removeChild(self, node):
node.parent = None

def insertText(self, data, insertBefore=None):
if not(len(self._element)):
if not len(self._element):
if not self._element.text:
self._element.text = ""
self._element.text += data
Expand Down Expand Up @@ -201,7 +201,7 @@ def testSerializer(element):
rv = []

def serializeElement(element, indent=0):
if not(hasattr(element, "tag")):
if not hasattr(element, "tag"):
element = element.getroot()
if element.tag == "<!DOCTYPE>":
if element.get("publicId") or element.get("systemId"):
Expand Down
2 changes: 1 addition & 1 deletion html5lib/treewalkers/etree.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def getNodeDetails(self, node):
else:
node = elt

if not(hasattr(node, "tag")):
if not hasattr(node, "tag"):
node = node.getroot()

if node.tag in ("DOCUMENT_ROOT", "DOCUMENT_FRAGMENT"):
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-r requirements.txt

tox>=3.15.1,<4
flake8>=3.8.1,<3.9
flake8>=3.8.1,<6
pytest>=4.6.10,<5 ; python_version < '3'
pytest>=5.4.2,<7 ; python_version >= '3'
coverage>=5.1,<6
Expand Down