Skip to content

Fix #146; fix all pep8 1.5.4 failures #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2014
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
3 changes: 1 addition & 2 deletions html5lib/html5parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1216,8 +1216,7 @@ def startTagIsIndex(self, token):
attributes["name"] = "isindex"
self.processStartTag(impliedTagToken("input", "StartTag",
attributes=attributes,
selfClosing=
token["selfClosing"]))
selfClosing=token["selfClosing"]))
self.processEndTag(impliedTagToken("label"))
self.processStartTag(impliedTagToken("hr", "StartTag"))
self.processEndTag(impliedTagToken("form"))
Expand Down
2 changes: 1 addition & 1 deletion html5lib/sanitizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def sanitize_css(self, style):
elif prop.split('-')[0].lower() in ['background', 'border', 'margin',
'padding']:
for keyword in value.split():
if not keyword in self.acceptable_css_keywords and \
if keyword not in self.acceptable_css_keywords and \
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):
break
else:
Expand Down
4 changes: 2 additions & 2 deletions html5lib/serializer/htmlserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
v = utils.surrogatePairToCodepoint(v)
else:
v = ord(v)
if not v in encode_entity_map or k.islower():
if v not in encode_entity_map or k.islower():
# prefer < over < and similarly for &, >, etc.
encode_entity_map[v] = k

Expand Down Expand Up @@ -291,7 +291,7 @@ def serialize(self, treewalker, encoding=None):
elif type == "Entity":
name = token["name"]
key = name + ";"
if not key in entities:
if key not in entities:
self.serializeError(_("Entity %s not recognized" % name))
if self.resolve_entities and key not in xmlEntities:
data = entities[key]
Expand Down
6 changes: 3 additions & 3 deletions html5lib/tests/test_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def processParseError(self, token):
def concatenateCharacterTokens(tokens):
outputTokens = []
for token in tokens:
if not "ParseError" in token and token[0] == "Character":
if (outputTokens and not "ParseError" in outputTokens[-1] and
if "ParseError" not in token and token[0] == "Character":
if (outputTokens and "ParseError" not in outputTokens[-1] and
outputTokens[-1][0] == "Character"):
outputTokens[-1][1] += token[1]
else:
Expand Down Expand Up @@ -112,7 +112,7 @@ def tokensMatch(expectedTokens, receivedTokens, ignoreErrorOrder,
# Sort the tokens into two groups; non-parse errors and parse errors
tokens = {"expected": [[], []], "received": [[], []]}
for tokenType, tokenList in zip(list(tokens.keys()),
(expectedTokens, receivedTokens)):
(expectedTokens, receivedTokens)):
for token in tokenList:
if token != "ParseError":
tokens[tokenType][0].append(token)
Expand Down
2 changes: 1 addition & 1 deletion html5lib/treebuilders/dom.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def insertText(self, data, parent=None):
else:
# HACK: allow text nodes as children of the document node
if hasattr(self.dom, '_child_node_types'):
if not Node.TEXT_NODE in self.dom._child_node_types:
if Node.TEXT_NODE not in self.dom._child_node_types:
self.dom._child_node_types = list(self.dom._child_node_types)
self.dom._child_node_types.append(Node.TEXT_NODE)
self.dom.appendChild(self.dom.createTextNode(data))
Expand Down