Skip to content

Commit cc110e6

Browse files
author
Drew Hubl
committed
Use Python sets instead of conditional continues
1 parent f5fd711 commit cc110e6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

html5lib/sanitizer.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,7 @@ def allowed_token(self, token, token_type):
182182
attrs = dict([(name, val) for name, val in
183183
token["data"][::-1]
184184
if name in self.allowed_attributes])
185-
for attr in self.attr_val_is_uri:
186-
if attr not in attrs:
187-
continue
185+
for attr in set(attrs.keys()).intersection(set(self.attr_val_is_uri)):
188186
val_unescaped = re.sub("[`\000-\040\177-\240\s]+", '',
189187
unescape(attrs[attr])).lower()
190188
# remove replacement characters from unescaped characters

0 commit comments

Comments
 (0)