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

Commited014f6

Browse files
committed
Get tests running cleanly with -3
1 parentdf16775 commited014f6

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

‎html5lib/sanitizer.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ def sanitize_token(self, token):
166166
iftoken_typein (tokenTypes["StartTag"],tokenTypes["EndTag"],
167167
tokenTypes["EmptyTag"]):
168168
iftoken["name"]inself.allowed_elements:
169-
iftoken.has_key("data"):
169+
if"data"intoken:
170170
attrs=dict([(name,val)forname,valin
171171
token["data"][::-1]
172172
ifnameinself.allowed_attributes])
173173
forattrinself.attr_val_is_uri:
174-
ifnotattrs.has_key(attr):
174+
ifattrnotinattrs:
175175
continue
176176
val_unescaped=re.sub("[`\000-\040\177-\240\s]+",'',
177177
unescape(attrs[attr])).lower()
@@ -190,7 +190,7 @@ def sanitize_token(self, token):
190190
'xlink:href'inattrsandre.search('^\s*[^#\s].*',
191191
attrs['xlink:href'])):
192192
delattrs['xlink:href']
193-
ifattrs.has_key('style'):
193+
if'style'inattrs:
194194
attrs['style']=self.sanitize_css(attrs['style'])
195195
token["data"]= [[name,val]forname,valinattrs.items()]
196196
returntoken

‎html5lib/serializer/htmlserializer.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
# Import from the sets module for python 2.3
55
fromsetsimportImmutableSetasfrozenset
66

7+
try:
8+
# use functools.reduce to avoid DeprecationWarning with -3
9+
fromfunctoolsimportreduce
10+
exceptImportError:
11+
pass
12+
713
importgettext
814
_=gettext.gettext
915

@@ -150,7 +156,7 @@ def __init__(self, **kwargs):
150156
151157
.. _html5lib user documentation: http://code.google.com/p/html5lib/wiki/UserDocumentation
152158
"""
153-
ifkwargs.has_key('quote_char'):
159+
if'quote_char'inkwargs:
154160
self.use_best_quote_char=False
155161
forattrinself.options:
156162
setattr(self,attr,kwargs.get(attr,getattr(self,attr)))

‎html5lib/tests/test_tokenizer.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def tokensMatch(expectedTokens, receivedTokens, ignoreErrorOrder,
124124

125125
defunescape_test(test):
126126
defdecode(inp):
127-
returninp.decode("unicode-escape")
127+
returninp.encode("utf-8").decode("unicode-escape")
128128

129129
test["input"]=decode(test["input"])
130130
fortokenintest["output"]:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp