jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/807485 )

Change subject: [IMPR] Simplify final throttle.drop() call
......................................................................

[IMPR] Simplify final throttle.drop() call

use popitem() to get any Site instead creating a list of all values

Change-Id: Ic89ef54ab3ad182208d1779442e9c7720c9286f5
---
M pywikibot/__init__.py
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 8954930..65de1f7 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -1345,8 +1345,8 @@
             page_put_queue.not_full.notify_all()

     # only need one drop() call because all throttles use the same global pid
-    with suppress(IndexError):
-        list(_sites.values())[0].throttle.drop()
+    with suppress(KeyError):
+        _sites.popitem()[1].throttle.drop()
         log('Dropped throttle(s).')



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

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

Reply via email to