Skip to content

Commit 41c90ae

Browse files
committed
Fix html5lib#146; fix all pep8 1.5.4 failures
1 parent 808d102 commit 41c90ae

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

html5lib/html5parser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,8 +1216,7 @@ def startTagIsIndex(self, token):
12161216
attributes["name"] = "isindex"
12171217
self.processStartTag(impliedTagToken("input", "StartTag",
12181218
attributes=attributes,
1219-
selfClosing=
1220-
token["selfClosing"]))
1219+
selfClosing=token["selfClosing"]))
12211220
self.processEndTag(impliedTagToken("label"))
12221221
self.processStartTag(impliedTagToken("hr", "StartTag"))
12231222
self.processEndTag(impliedTagToken("form"))

html5lib/sanitizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def sanitize_css(self, style):
245245
elif prop.split('-')[0].lower() in ['background', 'border', 'margin',
246246
'padding']:
247247
for keyword in value.split():
248-
if not keyword in self.acceptable_css_keywords and \
248+
if keyword not in self.acceptable_css_keywords and \
249249
not re.match("^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword):
250250
break
251251
else:

html5lib/serializer/htmlserializer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
v = utils.surrogatePairToCodepoint(v)
3636
else:
3737
v = ord(v)
38-
if not v in encode_entity_map or k.islower():
38+
if v not in encode_entity_map or k.islower():
3939
# prefer < over < and similarly for &, >, etc.
4040
encode_entity_map[v] = k
4141

@@ -291,7 +291,7 @@ def serialize(self, treewalker, encoding=None):
291291
elif type == "Entity":
292292
name = token["name"]
293293
key = name + ";"
294-
if not key in entities:
294+
if key not in entities:
295295
self.serializeError(_("Entity %s not recognized" % name))
296296
if self.resolve_entities and key not in xmlEntities:
297297
data = entities[key]

html5lib/tests/test_tokenizer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def processParseError(self, token):
6868
def concatenateCharacterTokens(tokens):
6969
outputTokens = []
7070
for token in tokens:
71-
if not "ParseError" in token and token[0] == "Character":
72-
if (outputTokens and not "ParseError" in outputTokens[-1] and
71+
if "ParseError" not in token and token[0] == "Character":
72+
if (outputTokens and "ParseError" not in outputTokens[-1] and
7373
outputTokens[-1][0] == "Character"):
7474
outputTokens[-1][1] += token[1]
7575
else:
@@ -112,7 +112,7 @@ def tokensMatch(expectedTokens, receivedTokens, ignoreErrorOrder,
112112
# Sort the tokens into two groups; non-parse errors and parse errors
113113
tokens = {"expected": [[], []], "received": [[], []]}
114114
for tokenType, tokenList in zip(list(tokens.keys()),
115-
(expectedTokens, receivedTokens)):
115+
(expectedTokens, receivedTokens)):
116116
for token in tokenList:
117117
if token != "ParseError":
118118
tokens[tokenType][0].append(token)

html5lib/treebuilders/dom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def insertText(self, data, parent=None):
158158
else:
159159
# HACK: allow text nodes as children of the document node
160160
if hasattr(self.dom, '_child_node_types'):
161-
if not Node.TEXT_NODE in self.dom._child_node_types:
161+
if Node.TEXT_NODE not in self.dom._child_node_types:
162162
self.dom._child_node_types = list(self.dom._child_node_types)
163163
self.dom._child_node_types.append(Node.TEXT_NODE)
164164
self.dom.appendChild(self.dom.createTextNode(data))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy