jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100776?usp=email )
Change subject: IMPR: use NoneType instead of type(None) ......................................................................
IMPR: use NoneType instead of type(None)
Change-Id: Iea7e9b3afee4fe67468e402e0119a7b5ff707e62 --- M pywikibot/comms/eventstreams.py M tests/basesite_tests.py M tests/wikistats_tests.py 3 files changed, 6 insertions(+), 3 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/pywikibot/comms/eventstreams.py b/pywikibot/comms/eventstreams.py index 35c02db..acddadc 100644 --- a/pywikibot/comms/eventstreams.py +++ b/pywikibot/comms/eventstreams.py @@ -22,6 +22,7 @@ from requests.packages.urllib3.util.response import httplib
from pywikibot import Site, Timestamp, config, debug, warning +from pywikibot.backports import NoneType from pywikibot.tools import cached from pywikibot.tools.collections import GeneratorWrapper
@@ -287,7 +288,7 @@ # register pairs of keys and items as a filter function for key, value in kwargs.items(): # append function for singletons - if isinstance(value, (bool, type(None))): + if isinstance(value, (bool, NoneType)): self.filter[ftype].append(partial(_is, key=key, value=value)) # append function for a single value elif isinstance(value, (str, int)): diff --git a/tests/basesite_tests.py b/tests/basesite_tests.py index 4636eb1..1c7b497 100755 --- a/tests/basesite_tests.py +++ b/tests/basesite_tests.py @@ -10,6 +10,7 @@ from contextlib import suppress
import pywikibot +from pywikibot.backports import NoneType from pywikibot.exceptions import Error from tests.aspects import DefaultSiteTestCase, TestCase, unittest
@@ -87,7 +88,7 @@ self.assertEqual(mysite.code, code) self.assertIsInstance(mysite.lang, str) self.assertEqual(mysite, pywikibot.Site(self.code, self.family)) - self.assertIsInstance(mysite.user(), (str, type(None))) + self.assertIsInstance(mysite.user(), (str, NoneType)) self.assertEqual(mysite.sitename, f'{self.family}:{code}') self.assertIsInstance(mysite.linktrail(), str) self.assertIsInstance(mysite.redirect(), str) diff --git a/tests/wikistats_tests.py b/tests/wikistats_tests.py index d94e6e9..018452b 100755 --- a/tests/wikistats_tests.py +++ b/tests/wikistats_tests.py @@ -11,6 +11,7 @@ import unittest from contextlib import suppress
+from pywikibot.backports import NoneType from pywikibot.data.wikistats import WikiStats from tests.aspects import TestCase
@@ -36,7 +37,7 @@ self.assertIn(key, bottom)
for key in top: - self.assertIsInstance(key, (str, type(None))) + self.assertIsInstance(key, (str, NoneType))
self.assertIsInstance(top['good'], str) self.assertIsInstance(top['total'], str)
pywikibot-commits@lists.wikimedia.org