jenkins-bot merged this change.

View Change

Approvals: Dvorapa: Looks good to me, approved jenkins-bot: Verified
[IMPR] logging._inited_routines as a set

- change logging._inited_routines from list to set
for better lookup

Change-Id: Ia4d9a5b287767edfb43390f4142b9dbee8a58707
---
M pywikibot/logging.py
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pywikibot/logging.py b/pywikibot/logging.py
index 1074188..033c628 100644
--- a/pywikibot/logging.py
+++ b/pywikibot/logging.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Logging functions."""
#
-# (C) Pywikibot team, 2010-2019
+# (C) Pywikibot team, 2010-2020
#
# Distributed under the terms of the MIT license.
#
@@ -22,7 +22,7 @@
unicode = str

_init_routines = []
-_inited_routines = []
+_inited_routines = set()


def add_init_routine(routine):
@@ -35,10 +35,10 @@
for init_routine in _init_routines:
if init_routine not in _inited_routines:
init_routine()
- _inited_routines.append(init_routine)
+ _inited_routines.add(init_routine)

# Clear the list of routines to be inited
- _init_routines[:] = []
+ _init_routines[:] = [] # the global variable is used with slice operator


# User output/logging functions

To view, visit change 579864. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia4d9a5b287767edfb43390f4142b9dbee8a58707
Gerrit-Change-Number: 579864
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)