jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[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(-)

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 change 807485. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic89ef54ab3ad182208d1779442e9c7720c9286f5
Gerrit-Change-Number: 807485
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged