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

Commit40c3ba6

Browse files
committed
Fix lint to expect text_type everywhere
1 parentaf0199c commit40c3ba6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

‎html5lib/filters/lint.py‎

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

3+
fromsiximporttext_type
4+
35
from .import_base
46
from ..constantsimportcdataElements,rcdataElements,voidElements
57

@@ -21,7 +23,7 @@ def __iter__(self):
2123
name=token["name"]
2224
ifcontentModelFlag!="PCDATA":
2325
raiseLintError("StartTag not in PCDATA content model flag: %(tag)s"% {"tag":name})
24-
ifnotisinstance(name,str):
26+
ifnotisinstance(name,text_type):
2527
raiseLintError("Tag name is not a string: %(tag)r"% {"tag":name})
2628
ifnotname:
2729
raiseLintError("Empty tag name")
@@ -32,11 +34,11 @@ def __iter__(self):
3234
iftype=="StartTag":
3335
open_elements.append(name)
3436
forname,valueintoken["data"]:
35-
ifnotisinstance(name,str):
37+
ifnotisinstance(name,text_type):
3638
raiseLintError("Attribute name is not a string: %(name)r"% {"name":name})
3739
ifnotname:
3840
raiseLintError("Empty attribute name")
39-
ifnotisinstance(value,str):
41+
ifnotisinstance(value,text_type):
4042
raiseLintError("Attribute value is not a string: %(value)r"% {"value":value})
4143
ifnameincdataElements:
4244
contentModelFlag="CDATA"
@@ -47,7 +49,7 @@ def __iter__(self):
4749

4850
eliftype=="EndTag":
4951
name=token["name"]
50-
ifnotisinstance(name,str):
52+
ifnotisinstance(name,text_type):
5153
raiseLintError("Tag name is not a string: %(tag)r"% {"tag":name})
5254
ifnotname:
5355
raiseLintError("Empty tag name")
@@ -64,7 +66,7 @@ def __iter__(self):
6466

6567
eliftypein ("Characters","SpaceCharacters"):
6668
data=token["data"]
67-
ifnotisinstance(data,str):
69+
ifnotisinstance(data,text_type):
6870
raiseLintError("Attribute name is not a string: %(name)r"% {"name":data})
6971
ifnotdata:
7072
raiseLintError("%(type)s token with empty data"% {"type":type})
@@ -77,7 +79,7 @@ def __iter__(self):
7779
name=token["name"]
7880
ifcontentModelFlag!="PCDATA":
7981
raiseLintError("Doctype not in PCDATA content model flag: %(name)s"% {"name":name})
80-
ifnotisinstance(name,str):
82+
ifnotisinstance(name,text_type):
8183
raiseLintError("Tag name is not a string: %(tag)r"% {"tag":name})
8284
# XXX: what to do with token["data"] ?
8385

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp