jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1330579?usp=email )
Change subject: tools: Use isdisjoint for invisible character check ......................................................................
tools: Use isdisjoint for invisible character check
Delegate the overlap check to frozenset.isdisjoint instead of iterating through a Python generator.
Change-Id: I4822f5f9684e7f184f712c728458166c0a0bbbbe --- M pywikibot/tools/chars.py 1 file changed, 1 insertion(+), 1 deletion(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/tools/chars.py b/pywikibot/tools/chars.py index 9ed74f1..c49d8a4 100644 --- a/pywikibot/tools/chars.py +++ b/pywikibot/tools/chars.py @@ -24,7 +24,7 @@
def contains_invisible(text): """Return True if the text contain any of the invisible characters.""" - return any(char in _invisible_chars for char in text) + return not _invisible_chars.isdisjoint(text)
def replace_invisible(text):
pywikibot-commits@lists.wikimedia.org