Skip to content
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

Add prospector and fix some bugs #218

Merged
merged 27 commits into from
May 20, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c64bfca
Get rid of mutable default arguments
gsnedders Dec 3, 2015
c1c16ce
Avoid noisiness from pylint and the parser's set patterns
gsnedders Dec 4, 2015
2c3b64b
add pep8/flake8 config to get something useful happening with them
gsnedders May 20, 2016
8238648
Fix all the files outside of html5lib to flake8 cleanly
gsnedders May 20, 2016
de6bcf2
Fix incorrectly hidden flake8 errors
gsnedders May 20, 2016
0bd31c4
Get rid of type()-based type-check
gsnedders May 20, 2016
d440a83
Silence pytest unused-variable warnings
gsnedders May 20, 2016
5c1d8e2
Remove duplicate entry from constants.replacementCharacters
gsnedders May 20, 2016
1b86ccb
Remove gratuitious argument in sanitizer
gsnedders May 20, 2016
82d623b
Silence redefined-variable-type
gsnedders May 20, 2016
a017b88
Silence unused-argument
gsnedders May 20, 2016
e5d395c
Silence wrong-import-position
gsnedders May 20, 2016
b64df28
Change which way around we overwrite this for clarity's sake
gsnedders May 20, 2016
df0b2ba
Remove unused import
gsnedders May 20, 2016
742715d
Fix invalid_unicode_re on platforms supporting lone surrogates
gsnedders May 20, 2016
cd74ec7
Fix comment
gsnedders May 20, 2016
15e126f
Silence eval-used
gsnedders May 20, 2016
bfc278a
Silence bare-except
gsnedders May 20, 2016
b46fcdf
Silence too-many-nested-blocks
gsnedders May 20, 2016
6945bc4
Silence not-callable
gsnedders May 20, 2016
0c290e0
Kill long-dead finalText code
gsnedders May 20, 2016
da099dc
Silence a buggily output non-parent-init-called
gsnedders May 20, 2016
97427de
Fix indentation
gsnedders May 20, 2016
2afe09b
Make this in practice unreachable code work on Py2
gsnedders May 20, 2016
c0df867
Silence arguments-differ
gsnedders May 20, 2016
5dce4f2
Silence protected-access
gsnedders May 20, 2016
a2b8c11
Add prospector/pylint config for the sake of Landscape.
gsnedders Dec 4, 2015
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
Prev Previous commit
Next Next commit
Silence unused-argument
  • Loading branch information
gsnedders committed May 20, 2016
commit a017b8881f42b2ab21a2f47af993ba6d58b25ca2
2 changes: 2 additions & 0 deletions html5lib/html5parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ def parse(self, stream, encoding=None, parseMeta=True,

def parseFragment(self, stream, container="div", encoding=None,
parseMeta=False, useChardet=True, scripting=False):
# pylint:disable=unused-argument
"""Parse a HTML fragment into a well-formed tree fragment

container - name of the element we're setting the innerHTML property
Expand Down Expand Up @@ -363,6 +364,7 @@ def adjustForeignAttributes(self, token):
del token["data"][originalName]

def reparseTokenNormal(self, token):
# pylint:disable=unused-argument
self.parser.phase()

def resetInsertionMode(self):
Expand Down
4 changes: 2 additions & 2 deletions html5lib/ihatexml.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def escapeRegexp(string):
class InfosetFilter(object):
replacementRegexp = re.compile(r"U[\dA-F]{5,5}")

def __init__(self, replaceChars=None,
def __init__(self,
dropXmlnsLocalName=False,
dropXmlnsAttrNs=False,
preventDoubleDashComments=False,
Expand Down Expand Up @@ -217,7 +217,7 @@ def coerceAttribute(self, name, namespace=None):
else:
return self.toXmlName(name)

def coerceElement(self, name, namespace=None):
def coerceElement(self, name):
return self.toXmlName(name)

def coerceComment(self, data):
Expand Down
1 change: 1 addition & 0 deletions html5lib/inputstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ def __new__(self, value):
return bytes.__new__(self, value.lower())

def __init__(self, value):
# pylint:disable=unused-argument
self._position = -1

def __iter__(self):
Expand Down
2 changes: 1 addition & 1 deletion html5lib/serializer/htmlserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,6 @@ def serializeError(self, data="XXX ERROR MESSAGE NEEDED"):
raise SerializeError


def SerializeError(Exception):
class SerializeError(Exception):
"""Error in serialized tree"""
pass
2 changes: 1 addition & 1 deletion html5lib/tests/test_sanitizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from html5lib.filters import sanitizer


def runSanitizerTest(name, expected, input):
def runSanitizerTest(_, expected, input):
parsed = parseFragment(expected)
expected = serialize(parsed,
omit_optional_tags=False,
Expand Down
2 changes: 2 additions & 0 deletions html5lib/tests/test_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def test_python_issue_20007():
"""
class FakeSocket(object):
def makefile(self, _mode, _bufsize=None):
# pylint:disable=unused-argument
return BytesIO(b"HTTP/1.1 200 Ok\r\n\r\nText")

source = http_client.HTTPResponse(FakeSocket())
Expand All @@ -202,6 +203,7 @@ def test_python_issue_20007_b():

class FakeSocket(object):
def makefile(self, _mode, _bufsize=None):
# pylint:disable=unused-argument
return BytesIO(b"HTTP/1.1 200 Ok\r\n\r\nText")

source = http_client.HTTPResponse(FakeSocket())
Expand Down
1 change: 1 addition & 0 deletions html5lib/tests/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(self, initialState, lastStartTag=None):
self._lastStartTag = lastStartTag

def parse(self, stream, encoding=None, innerHTML=False):
# pylint:disable=unused-argument
tokenizer = self.tokenizer(stream, encoding)
self.outputTokens = []

Expand Down
2 changes: 2 additions & 0 deletions html5lib/treebuilders/etree_lxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ def insertDoctype(self, token):
self.doctype = doctype

def insertCommentInitial(self, data, parent=None):
assert parent is None or parent is self.document
assert self.document._elementTree is None
self.initial_comments.append(data)

def insertCommentMain(self, data, parent=None):
Expand Down