Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1325898?usp=email )

Change subject: generate_family_file: Short-circuit local wiki lookup
......................................................................

generate_family_file: Short-circuit local wiki lookup

Stop scanning interwiki entries after finding the local wiki URL.

Avoid building a temporary list solely to test for a match.

Change-Id: I31f22942b4628c763b2f8153aef61c86e4afc755
---
M pywikibot/scripts/generate_family_file.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Xqt: Verified; Looks good to me, approved




diff --git a/pywikibot/scripts/generate_family_file.py 
b/pywikibot/scripts/generate_family_file.py
index 160b053..19905b1 100755
--- a/pywikibot/scripts/generate_family_file.py
+++ b/pywikibot/scripts/generate_family_file.py
@@ -186,7 +186,7 @@
             self.langs = []
             self.show(e, '; continuing...')

-        if len([lang for lang in self.langs if lang['url'] == w.iwpath]) == 0:
+        if not any(lang['url'] == w.iwpath for lang in self.langs):
             if w.private_wiki:
                 w.lang = self.name
             self.langs.append({'language': w.lang,

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1325898?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I31f22942b4628c763b2f8153aef61c86e4afc755
Gerrit-Change-Number: 1325898
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to