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

Commit5decf47

Browse files
authored
remove redundant list comprehension (#547)
any() accepts a generator. This will cause it to run faster because the any() returns as soon as it finds a True value.
1 parent6815a54 commit5decf47

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎html5lib/html5parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,8 +1002,8 @@ def processCharacters(self, token):
10021002
self.tree.insertText(token["data"])
10031003
# This must be bad for performance
10041004
if (self.parser.framesetOKand
1005-
any([charnotinspaceCharacters
1006-
forcharintoken["data"]])):
1005+
any(charnotinspaceCharacters
1006+
forcharintoken["data"])):
10071007
self.parser.framesetOK=False
10081008

10091009
defprocessSpaceCharactersNonPre(self,token):
@@ -1850,7 +1850,7 @@ def __init__(self, *args, **kwargs):
18501850

18511851
defflushCharacters(self):
18521852
data="".join([item["data"]foriteminself.characterTokens])
1853-
ifany([itemnotinspaceCharactersforitemindata]):
1853+
ifany(itemnotinspaceCharactersforitemindata):
18541854
token= {"type":tokenTypes["Characters"],"data":data}
18551855
self.parser.phases["inTable"].insertText(token)
18561856
elifdata:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp