Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitde6bcf2

Browse files
committed
Fix incorrectly hidden flake8 errors
1 parent8238648 commitde6bcf2

File tree

7 files changed

+49
-27
lines changed

7 files changed

+49
-27
lines changed

‎html5lib/tests/support.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
os.path.pardir,
1414
os.path.pardir)))
1515

16-
fromhtml5libimporttreebuilders,treewalkers,treeadapters
16+
fromhtml5libimporttreebuilders,treewalkers,treeadapters# noqa
1717
delbase_path
1818

1919
# Build a dict of available trees
@@ -26,14 +26,14 @@
2626
}
2727

2828
# ElementTree impls
29-
importxml.etree.ElementTreeasElementTree
29+
importxml.etree.ElementTreeasElementTree# noqa
3030
treeTypes['ElementTree']= {
3131
"builder":treebuilders.getTreeBuilder("etree",ElementTree,fullTree=True),
3232
"walker":treewalkers.getTreeWalker("etree",ElementTree)
3333
}
3434

3535
try:
36-
importxml.etree.cElementTreeascElementTree
36+
importxml.etree.cElementTreeascElementTree# noqa
3737
exceptImportError:
3838
treeTypes['cElementTree']=None
3939
else:
@@ -47,7 +47,7 @@
4747
}
4848

4949
try:
50-
importlxml.etreeaslxml#flake8:noqa
50+
importlxml.etreeaslxml# noqa
5151
exceptImportError:
5252
treeTypes['lxml']=None
5353
else:
@@ -58,7 +58,7 @@
5858

5959
# Genshi impls
6060
try:
61-
importgenshi#flake8:noqa
61+
importgenshi# noqa
6262
exceptImportError:
6363
pass
6464
else:

‎html5lib/tests/test_encoding.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ def test_encoding():
5757

5858
try:
5959
try:
60-
importcharade#flake8:noqa
60+
importcharade# noqa
6161
exceptImportError:
62-
importchardet#flake8:noqa
62+
importchardet# noqa
6363
exceptImportError:
6464
print("charade/chardet not found, skipping chardet tests")
6565
else:
6666
deftest_chardet():
67-
withopen(os.path.join(test_dir,"encoding","chardet","test_big5.txt"),"rb")asfp:
67+
withopen(os.path.join(test_dir,"encoding","chardet","test_big5.txt"),"rb")asfp:
6868
encoding=inputstream.HTMLInputStream(fp.read()).charEncoding
6969
assertencoding[0].name=="big5"

‎html5lib/tests/test_parser2.py‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
importio
44

5-
importpytest
5+
from .importsupport# noqa
66

7-
from .importsupport# flake8: noqa
8-
fromhtml5libimporthtml5parser
97
fromhtml5lib.constantsimportnamespaces
108
fromhtml5libimportparse
119

@@ -23,29 +21,29 @@ def test_line_counter():
2321

2422
deftest_namespace_html_elements_0_dom():
2523
doc=parse("<html></html>",
26-
treebuilder="dom",
27-
namespaceHTMLElements=True)
24+
treebuilder="dom",
25+
namespaceHTMLElements=True)
2826
assertdoc.childNodes[0].namespaceURI==namespaces["html"]
2927

3028

3129
deftest_namespace_html_elements_1_dom():
3230
doc=parse("<html></html>",
33-
treebuilder="dom",
34-
namespaceHTMLElements=False)
31+
treebuilder="dom",
32+
namespaceHTMLElements=False)
3533
assertdoc.childNodes[0].namespaceURIisNone
3634

3735

3836
deftest_namespace_html_elements_0_etree():
3937
doc=parse("<html></html>",
40-
treebuilder="etree",
41-
namespaceHTMLElements=True)
38+
treebuilder="etree",
39+
namespaceHTMLElements=True)
4240
assertdoc.tag=="{%s}html"% (namespaces["html"],)
4341

4442

4543
deftest_namespace_html_elements_1_etree():
4644
doc=parse("<html></html>",
47-
treebuilder="etree",
48-
namespaceHTMLElements=False)
45+
treebuilder="etree",
46+
namespaceHTMLElements=False)
4947
assertdoc.tag=="html"
5048

5149

‎html5lib/tests/test_stream.py‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
from __future__importabsolute_import,division,unicode_literals
22

3-
from .importsupport# flake8: noqa
3+
from .importsupport# noqa
4+
45
importcodecs
56
fromioimportBytesIO
6-
importsocket
77

88
importsix
99
fromsix.movesimporthttp_client,urllib
1010

1111
fromhtml5lib.inputstreamimport (BufferedStream,HTMLInputStream,
1212
HTMLUnicodeInputStream,HTMLBinaryInputStream)
1313

14+
1415
deftest_basic():
1516
s=b"abc"
1617
fp=BufferedStream(BytesIO(s))
1718
read=fp.read(10)
1819
assertread==s
1920

21+
2022
deftest_read_length():
2123
fp=BufferedStream(BytesIO(b"abcdef"))
2224
read1=fp.read(1)
@@ -28,17 +30,23 @@ def test_read_length():
2830
read4=fp.read(4)
2931
assertread4==b""
3032

33+
3134
deftest_tell():
3235
fp=BufferedStream(BytesIO(b"abcdef"))
3336
read1=fp.read(1)
37+
assertread1==b"a"
3438
assertfp.tell()==1
3539
read2=fp.read(2)
40+
assertread2==b"bc"
3641
assertfp.tell()==3
3742
read3=fp.read(3)
43+
assertread3==b"def"
3844
assertfp.tell()==6
3945
read4=fp.read(4)
46+
assertread4==b""
4047
assertfp.tell()==6
4148

49+
4250
deftest_seek():
4351
fp=BufferedStream(BytesIO(b"abcdef"))
4452
read1=fp.read(1)
@@ -55,20 +63,26 @@ def test_seek():
5563
read5=fp.read(2)
5664
assertread5==b"ef"
5765

66+
5867
deftest_seek_tell():
5968
fp=BufferedStream(BytesIO(b"abcdef"))
6069
read1=fp.read(1)
70+
assertread1==b"a"
6171
assertfp.tell()==1
6272
fp.seek(0)
6373
read2=fp.read(1)
74+
assertread2==b"a"
6475
assertfp.tell()==1
6576
read3=fp.read(2)
77+
assertread3==b"bc"
6678
assertfp.tell()==3
6779
fp.seek(2)
6880
read4=fp.read(2)
81+
assertread4==b"cd"
6982
assertfp.tell()==4
7083
fp.seek(4)
7184
read5=fp.read(2)
85+
assertread5==b"ef"
7286
assertfp.tell()==6
7387

7488

@@ -85,28 +99,33 @@ def test_char_ascii():
8599
assertstream.charEncoding[0].name=='windows-1252'
86100
assertstream.char()=="'"
87101

102+
88103
deftest_char_utf8():
89104
stream=HTMLInputStream('\u2018'.encode('utf-8'),encoding='utf-8')
90105
assertstream.charEncoding[0].name=='utf-8'
91106
assertstream.char()=='\u2018'
92107

108+
93109
deftest_char_win1252():
94110
stream=HTMLInputStream("\xa9\xf1\u2019".encode('windows-1252'))
95111
assertstream.charEncoding[0].name=='windows-1252'
96112
assertstream.char()=="\xa9"
97113
assertstream.char()=="\xf1"
98114
assertstream.char()=="\u2019"
99115

116+
100117
deftest_bom():
101118
stream=HTMLInputStream(codecs.BOM_UTF8+b"'")
102119
assertstream.charEncoding[0].name=='utf-8'
103120
assertstream.char()=="'"
104121

122+
105123
deftest_utf_16():
106124
stream=HTMLInputStream((' '*1025).encode('utf-16'))
107125
assertstream.charEncoding[0].namein ['utf-16le','utf-16be']
108126
assertlen(stream.charsUntil(' ',True))==1025
109127

128+
110129
deftest_newlines():
111130
stream=HTMLBinaryInputStreamShortChunk(codecs.BOM_UTF8+b"a\nbb\r\nccc\rddddxe")
112131
assertstream.position()== (1,0)
@@ -117,11 +136,13 @@ def test_newlines():
117136
assertstream.charsUntil('e')=="x"
118137
assertstream.position()== (4,5)
119138

139+
120140
deftest_newlines2():
121141
size=HTMLUnicodeInputStream._defaultChunkSize
122142
stream=HTMLInputStream("\r"*size+"\n")
123143
assertstream.charsUntil('x')=="\n"*size
124144

145+
125146
deftest_position():
126147
stream=HTMLBinaryInputStreamShortChunk(codecs.BOM_UTF8+b"a\nbb\nccc\nddde\nf\ngh")
127148
assertstream.position()== (1,0)
@@ -140,6 +161,7 @@ def test_position():
140161
assertstream.charsUntil('h')=="e\nf\ng"
141162
assertstream.position()== (6,1)
142163

164+
143165
deftest_position2():
144166
stream=HTMLUnicodeInputStreamShortChunk("abc\nd")
145167
assertstream.position()== (1,0)
@@ -154,6 +176,7 @@ def test_position2():
154176
assertstream.char()=="d"
155177
assertstream.position()== (2,1)
156178

179+
157180
deftest_python_issue_20007():
158181
"""
159182
Make sure we have a work-around for Python bug #20007
@@ -168,6 +191,7 @@ def makefile(self, _mode, _bufsize=None):
168191
stream=HTMLInputStream(source)
169192
assertstream.charsUntil(" ")=="Text"
170193

194+
171195
deftest_python_issue_20007_b():
172196
"""
173197
Make sure we have a work-around for Python bug #20007

‎html5lib/tests/test_treeadapters.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__importabsolute_import,division,unicode_literals
22

3-
from .importsupport#flake8:noqa
3+
from .importsupport# noqa
44

55
importhtml5lib
66
fromhtml5lib.treeadaptersimportsax
@@ -25,7 +25,7 @@ def test_to_sax():
2525
('endElementNS', ('http://www.w3.org/1999/xhtml','title'),'title'),
2626
('characters','\n '),
2727
('endElementNS', ('http://www.w3.org/1999/xhtml','head'),'head'),
28-
('startElementNS',('http://www.w3.org/1999/xhtml','body'),'body', {}),
28+
('startElementNS', ('http://www.w3.org/1999/xhtml','body'),'body', {}),
2929
('startElementNS', ('http://www.w3.org/1999/xhtml','a'),'a', {(None,'href'):'/'}),
3030
('startElementNS', ('http://www.w3.org/1999/xhtml','b'),'b', {}),
3131
('startElementNS', ('http://www.w3.org/1999/xhtml','p'),'p', {}),

‎html5lib/tokenizer.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__importabsolute_import,division,unicode_literals
22

33
try:
4-
chr=unichr# flake8: noqa
4+
chr=unichr# noqa
55
exceptNameError:
66
pass
77

@@ -147,8 +147,8 @@ def consumeEntity(self, allowedChar=None, fromAttribute=False):
147147
output="&"
148148

149149
charStack= [self.stream.char()]
150-
if (charStack[0]inspaceCharactersorcharStack[0]in (EOF,"<","&")
151-
or(allowedCharisnotNoneandallowedChar==charStack[0])):
150+
if (charStack[0]inspaceCharactersorcharStack[0]in (EOF,"<","&")or
151+
(allowedCharisnotNoneandallowedChar==charStack[0])):
152152
self.stream.unget(charStack[0])
153153

154154
elifcharStack[0]=="#":

‎html5lib/treeadapters/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
__all__= ["sax"]
66

77
try:
8-
from .importgenshi#flake8:noqa
8+
from .importgenshi# noqa
99
exceptImportError:
1010
pass
1111
else:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp