Skip to content

Commit 81b3aaf

Browse files
committed
Reduce list/tuple access
1 parent c22d069 commit 81b3aaf

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

html5lib/_inputstream.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -728,19 +728,20 @@ def handleMeta(self):
728728
if attr is None:
729729
return True
730730
else:
731-
if attr[0] == b"http-equiv":
732-
hasPragma = attr[1] == b"content-type"
731+
name, value = attr
732+
if name == b"http-equiv":
733+
hasPragma = value == b"content-type"
733734
if hasPragma and pendingEncoding is not None:
734735
self.encoding = pendingEncoding
735736
return False
736-
elif attr[0] == b"charset":
737-
tentativeEncoding = attr[1]
737+
elif name == b"charset":
738+
tentativeEncoding = value
738739
codec = lookupEncoding(tentativeEncoding)
739740
if codec is not None:
740741
self.encoding = codec
741742
return False
742-
elif attr[0] == b"content":
743-
contentParser = ContentAttrParser(EncodingBytes(attr[1]))
743+
elif name == b"content":
744+
contentParser = ContentAttrParser(EncodingBytes(value))
744745
tentativeEncoding = contentParser.parse()
745746
if tentativeEncoding is not None:
746747
codec = lookupEncoding(tentativeEncoding)

0 commit comments

Comments
 (0)