jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1326321?usp=email )
Change subject: interwikidata: Avoid temporary singleton lists
......................................................................
interwikidata: Avoid temporary singleton lists
Select the only item from each validated singleton set directly.
Avoid allocating and mutating a temporary list.
Change-Id: Ib424105de51c5fa358658fe0e9f038c7a48d293d
---
M scripts/interwikidata.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/interwikidata.py b/scripts/interwikidata.py
index cb6c3aa..c8fd98d 100755
--- a/scripts/interwikidata.py
+++ b/scripts/interwikidata.py
@@ -197,7 +197,7 @@
f'{self.current_page.title(as_link=True)}, skipping...')
return False
- item = list(wd_data).pop()
+ item = next(iter(wd_data))
if self.current_page.site.dbName() in item.sitelinks:
warning(f'Interwiki conflict in {item}, skipping...')
return False
@@ -218,7 +218,7 @@
warning(f'Interwiki conflict in {self.current_page}, skipping...')
return False
- target_item = list(wd_data).pop()
+ target_item = next(iter(wd_data))
try:
item.mergeInto(target_item)
except APIError:
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1326321?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: Ib424105de51c5fa358658fe0e9f038c7a48d293d
Gerrit-Change-Number: 1326321
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]