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

Commit44b0bbc

Browse files
committed
Merge pull request#223 from gsnedders/pep8_1.7_fixes
pep8 1.7 fixes
2 parents46dae3d +5e90af8 commit44b0bbc

File tree

11 files changed

+89
-168
lines changed

11 files changed

+89
-168
lines changed

‎html5lib/html5parser.py

Lines changed: 73 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ def mainLoop(self):
204204
eliftype==DoctypeToken:
205205
new_token=phase.processDoctype(new_token)
206206

207-
if (type==StartTagTokenandtoken["selfClosing"]
208-
andnottoken["selfClosingAcknowledged"]):
207+
if (type==StartTagTokenandtoken["selfClosing"]and
208+
nottoken["selfClosingAcknowledged"]):
209209
self.parseError("non-void-element-with-trailing-solidus",
210210
{"name":token["name"]})
211211

@@ -517,77 +517,76 @@ def processDoctype(self, token):
517517
ifpublicId!="":
518518
publicId=publicId.translate(asciiUpper2Lower)
519519

520-
if (notcorrectortoken["name"]!="html"
521-
orpublicId.startswith(
522-
("+//silmaril//dtd html pro v0r11 19970101//",
523-
"-//advasoft ltd//dtd html 3.0 aswedit + extensions//",
524-
"-//as//dtd html 3.0 aswedit + extensions//",
525-
"-//ietf//dtd html 2.0 level 1//",
526-
"-//ietf//dtd html 2.0 level 2//",
527-
"-//ietf//dtd html 2.0 strict level 1//",
528-
"-//ietf//dtd html 2.0 strict level 2//",
529-
"-//ietf//dtd html 2.0 strict//",
530-
"-//ietf//dtd html 2.0//",
531-
"-//ietf//dtd html 2.1e//",
532-
"-//ietf//dtd html 3.0//",
533-
"-//ietf//dtd html 3.2 final//",
534-
"-//ietf//dtd html 3.2//",
535-
"-//ietf//dtd html 3//",
536-
"-//ietf//dtd html level 0//",
537-
"-//ietf//dtd html level 1//",
538-
"-//ietf//dtd html level 2//",
539-
"-//ietf//dtd html level 3//",
540-
"-//ietf//dtd html strict level 0//",
541-
"-//ietf//dtd html strict level 1//",
542-
"-//ietf//dtd html strict level 2//",
543-
"-//ietf//dtd html strict level 3//",
544-
"-//ietf//dtd html strict//",
545-
"-//ietf//dtd html//",
546-
"-//metrius//dtd metrius presentational//",
547-
"-//microsoft//dtd internet explorer 2.0 html strict//",
548-
"-//microsoft//dtd internet explorer 2.0 html//",
549-
"-//microsoft//dtd internet explorer 2.0 tables//",
550-
"-//microsoft//dtd internet explorer 3.0 html strict//",
551-
"-//microsoft//dtd internet explorer 3.0 html//",
552-
"-//microsoft//dtd internet explorer 3.0 tables//",
553-
"-//netscape comm. corp.//dtd html//",
554-
"-//netscape comm. corp.//dtd strict html//",
555-
"-//o'reilly and associates//dtd html 2.0//",
556-
"-//o'reilly and associates//dtd html extended 1.0//",
557-
"-//o'reilly and associates//dtd html extended relaxed 1.0//",
558-
"-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//",
559-
"-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//",
560-
"-//spyglass//dtd html 2.0 extended//",
561-
"-//sq//dtd html 2.0 hotmetal + extensions//",
562-
"-//sun microsystems corp.//dtd hotjava html//",
563-
"-//sun microsystems corp.//dtd hotjava strict html//",
564-
"-//w3c//dtd html 3 1995-03-24//",
565-
"-//w3c//dtd html 3.2 draft//",
566-
"-//w3c//dtd html 3.2 final//",
567-
"-//w3c//dtd html 3.2//",
568-
"-//w3c//dtd html 3.2s draft//",
569-
"-//w3c//dtd html 4.0 frameset//",
570-
"-//w3c//dtd html 4.0 transitional//",
571-
"-//w3c//dtd html experimental 19960712//",
572-
"-//w3c//dtd html experimental 970421//",
573-
"-//w3c//dtd w3 html//",
574-
"-//w3o//dtd w3 html 3.0//",
575-
"-//webtechs//dtd mozilla html 2.0//",
576-
"-//webtechs//dtd mozilla html//"))
577-
orpublicIdin
578-
("-//w3o//dtd w3 html strict 3.0//en//",
579-
"-/w3c/dtd html 4.0 transitional/en",
580-
"html")
581-
orpublicId.startswith(
582-
("-//w3c//dtd html 4.01 frameset//",
583-
"-//w3c//dtd html 4.01 transitional//"))and
584-
systemIdisNone
585-
orsystemIdandsystemId.lower()=="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"):
520+
if (notcorrectortoken["name"]!="html"or
521+
publicId.startswith(
522+
("+//silmaril//dtd html pro v0r11 19970101//",
523+
"-//advasoft ltd//dtd html 3.0 aswedit + extensions//",
524+
"-//as//dtd html 3.0 aswedit + extensions//",
525+
"-//ietf//dtd html 2.0 level 1//",
526+
"-//ietf//dtd html 2.0 level 2//",
527+
"-//ietf//dtd html 2.0 strict level 1//",
528+
"-//ietf//dtd html 2.0 strict level 2//",
529+
"-//ietf//dtd html 2.0 strict//",
530+
"-//ietf//dtd html 2.0//",
531+
"-//ietf//dtd html 2.1e//",
532+
"-//ietf//dtd html 3.0//",
533+
"-//ietf//dtd html 3.2 final//",
534+
"-//ietf//dtd html 3.2//",
535+
"-//ietf//dtd html 3//",
536+
"-//ietf//dtd html level 0//",
537+
"-//ietf//dtd html level 1//",
538+
"-//ietf//dtd html level 2//",
539+
"-//ietf//dtd html level 3//",
540+
"-//ietf//dtd html strict level 0//",
541+
"-//ietf//dtd html strict level 1//",
542+
"-//ietf//dtd html strict level 2//",
543+
"-//ietf//dtd html strict level 3//",
544+
"-//ietf//dtd html strict//",
545+
"-//ietf//dtd html//",
546+
"-//metrius//dtd metrius presentational//",
547+
"-//microsoft//dtd internet explorer 2.0 html strict//",
548+
"-//microsoft//dtd internet explorer 2.0 html//",
549+
"-//microsoft//dtd internet explorer 2.0 tables//",
550+
"-//microsoft//dtd internet explorer 3.0 html strict//",
551+
"-//microsoft//dtd internet explorer 3.0 html//",
552+
"-//microsoft//dtd internet explorer 3.0 tables//",
553+
"-//netscape comm. corp.//dtd html//",
554+
"-//netscape comm. corp.//dtd strict html//",
555+
"-//o'reilly and associates//dtd html 2.0//",
556+
"-//o'reilly and associates//dtd html extended 1.0//",
557+
"-//o'reilly and associates//dtd html extended relaxed 1.0//",
558+
"-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//",
559+
"-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//",
560+
"-//spyglass//dtd html 2.0 extended//",
561+
"-//sq//dtd html 2.0 hotmetal + extensions//",
562+
"-//sun microsystems corp.//dtd hotjava html//",
563+
"-//sun microsystems corp.//dtd hotjava strict html//",
564+
"-//w3c//dtd html 3 1995-03-24//",
565+
"-//w3c//dtd html 3.2 draft//",
566+
"-//w3c//dtd html 3.2 final//",
567+
"-//w3c//dtd html 3.2//",
568+
"-//w3c//dtd html 3.2s draft//",
569+
"-//w3c//dtd html 4.0 frameset//",
570+
"-//w3c//dtd html 4.0 transitional//",
571+
"-//w3c//dtd html experimental 19960712//",
572+
"-//w3c//dtd html experimental 970421//",
573+
"-//w3c//dtd w3 html//",
574+
"-//w3o//dtd w3 html 3.0//",
575+
"-//webtechs//dtd mozilla html 2.0//",
576+
"-//webtechs//dtd mozilla html//"))or
577+
publicIdin ("-//w3o//dtd w3 html strict 3.0//en//",
578+
"-/w3c/dtd html 4.0 transitional/en",
579+
"html")or
580+
publicId.startswith(
581+
("-//w3c//dtd html 4.01 frameset//",
582+
"-//w3c//dtd html 4.01 transitional//"))and
583+
systemIdisNoneor
584+
systemIdandsystemId.lower()=="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"):
586585
self.parser.compatMode="quirks"
587586
elif (publicId.startswith(
588587
("-//w3c//dtd xhtml 1.0 frameset//",
589-
"-//w3c//dtd xhtml 1.0 transitional//"))
590-
orpublicId.startswith(
588+
"-//w3c//dtd xhtml 1.0 transitional//"))or
589+
publicId.startswith(
591590
("-//w3c//dtd html 4.01 frameset//",
592591
"-//w3c//dtd html 4.01 transitional//"))and
593592
systemIdisnotNone):
@@ -988,8 +987,8 @@ def processSpaceCharactersDropNewline(self, token):
988987
data=token["data"]
989988
self.processSpaceCharacters=self.processSpaceCharactersNonPre
990989
if (data.startswith("\n")and
991-
self.tree.openElements[-1].namein ("pre","listing","textarea")
992-
andnotself.tree.openElements[-1].hasContent()):
990+
self.tree.openElements[-1].namein ("pre","listing","textarea")and
991+
notself.tree.openElements[-1].hasContent()):
993992
data=data[1:]
994993
ifdata:
995994
self.tree.reconstructActiveFormattingElements()
@@ -1016,8 +1015,8 @@ def startTagProcessInHead(self, token):
10161015

10171016
defstartTagBody(self,token):
10181017
self.parser.parseError("unexpected-start-tag", {"name":"body"})
1019-
if (len(self.tree.openElements)==1
1020-
orself.tree.openElements[1].name!="body"):
1018+
if (len(self.tree.openElements)==1or
1019+
self.tree.openElements[1].name!="body"):
10211020
assertself.parser.innerHTML
10221021
else:
10231022
self.parser.framesetOK=False

‎html5lib/serializer/htmlserializer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ def serialize(self, treewalker, encoding=None):
237237

238238
yieldself.encodeStrict(k)
239239
ifnotself.minimize_boolean_attributesor \
240-
(knotinbooleanAttributes.get(name,tuple())
241-
andknotinbooleanAttributes.get("",tuple())):
240+
(knotinbooleanAttributes.get(name,tuple())and
241+
knotinbooleanAttributes.get("",tuple())):
242242
yieldself.encodeStrict("=")
243243
ifself.quote_attr_valuesornotv:
244244
quote_attr=True

‎html5lib/tests/mockParser.py

Lines changed: 0 additions & 41 deletions
This file was deleted.

‎html5lib/tests/performance/concatenation.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

‎html5lib/tests/test_serializer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ def runSerializerTest(input, expected, options):
9191
encoding=options.get("encoding",None)
9292

9393
ifencoding:
94-
encode=lambdax:x.encode(encoding)
95-
expected=list(map(encode,expected))
94+
expected=list(map(lambdax:x.encode(encoding),expected))
9695

9796
result=serialize_html(input,options)
9897
iflen(expected)==1:

‎html5lib/tests/test_tokenizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ def tokensMatch(expectedTokens, receivedTokens, ignoreErrorOrder,
9898
"""
9999
checkSelfClosing=False
100100
fortokeninexpectedTokens:
101-
if (token[0]=="StartTag"andlen(token)==4
102-
ortoken[0]=="EndTag"andlen(token)==3):
101+
if (token[0]=="StartTag"andlen(token)==4or
102+
token[0]=="EndTag"andlen(token)==3):
103103
checkSelfClosing=True
104104
break
105105

‎html5lib/treebuilders/_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ def getTableMisnestedNodePosition(self):
353353
defgenerateImpliedEndTags(self,exclude=None):
354354
name=self.openElements[-1].name
355355
# XXX td, th and tr are not actually needed
356-
if (nameinfrozenset(("dd","dt","li","option","optgroup","p","rp","rt"))
357-
andname!=exclude):
356+
if (nameinfrozenset(("dd","dt","li","option","optgroup","p","rp","rt"))and
357+
name!=exclude):
358358
self.openElements.pop()
359359
# XXX This is not entirely what the specification says. We should
360360
# investigate it more closely.

‎html5lib/treebuilders/dom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def __init__(self, element):
4747
_base.Node.__init__(self,element.nodeName)
4848
self.element=element
4949

50-
namespace=property(lambdaself:hasattr(self.element,"namespaceURI")
51-
andself.element.namespaceURIorNone)
50+
namespace=property(lambdaself:hasattr(self.element,"namespaceURI")and
51+
self.element.namespaceURIorNone)
5252

5353
defappendChild(self,node):
5454
node.parent=self

‎html5lib/treewalkers/__init__.py

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

1111
from __future__importabsolute_import,division,unicode_literals
1212

13-
__all__= ["getTreeWalker","pprint","dom","etree","genshistream","lxmletree"]
14-
1513
from ..importconstants
1614
from ..utilsimportdefault_etree
1715

16+
__all__= ["getTreeWalker","pprint","dom","etree","genshistream","lxmletree"]
17+
1818
treeWalkerCache= {}
1919

2020

‎html5lib/treewalkers/_base.py

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

4+
fromxml.domimportNode
5+
from ..constantsimportvoidElements,spaceCharacters
6+
47
__all__= ["DOCUMENT","DOCTYPE","TEXT","ELEMENT","COMMENT","ENTITY","UNKNOWN",
58
"TreeWalker","NonRecursiveTreeWalker"]
69

7-
fromxml.domimportNode
8-
910
DOCUMENT=Node.DOCUMENT_NODE
1011
DOCTYPE=Node.DOCUMENT_TYPE_NODE
1112
TEXT=Node.TEXT_NODE
@@ -14,7 +15,6 @@
1415
ENTITY=Node.ENTITY_NODE
1516
UNKNOWN="<#UNKNOWN#>"
1617

17-
from ..constantsimportvoidElements,spaceCharacters
1818
spaceCharacters="".join(spaceCharacters)
1919

2020

‎html5lib/treewalkers/genshistream.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ def tokens(self, event, next):
3939

4040
ifnamespace==namespaces["html"]andnameinvoidElements:
4141
fortokeninself.emptyTag(namespace,name,converted_attribs,
42-
notnextornext[0]!=END
43-
ornext[1]!=tag):
42+
notnextornext[0]!=ENDor
43+
next[1]!=tag):
4444
yieldtoken
4545
else:
4646
yieldself.startTag(namespace,name,converted_attribs)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp