jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/688417 )
Change subject: [C0201] iterating dictionary without keys() method ......................................................................
[C0201] iterating dictionary without keys() method
Change-Id: I5c59c6fa2a9825a4970630065bac03e603cebac4 --- M pywikibot/site/_datasite.py M scripts/template.py M tests/diff_tests.py 3 files changed, 4 insertions(+), 4 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site/_datasite.py b/pywikibot/site/_datasite.py index 5d97952..01b5a35 100644 --- a/pywikibot/site/_datasite.py +++ b/pywikibot/site/_datasite.py @@ -53,7 +53,7 @@ def _cache_entity_namespaces(self): """Find namespaces for each known wikibase entity type.""" self._entity_namespaces = {} - for entity_type in self._type_to_class.keys(): + for entity_type in self._type_to_class: for namespace in self.namespaces.values(): if not hasattr(namespace, 'defaultcontentmodel'): continue diff --git a/scripts/template.py b/scripts/template.py index 0c5122d..f87d82b 100755 --- a/scripts/template.py +++ b/scripts/template.py @@ -280,7 +280,7 @@ return
old_templates = [] - for template_name in templates.keys(): + for template_name in templates: old_template = pywikibot.Page(site, template_name, ns=10) old_templates.append(old_template)
diff --git a/tests/diff_tests.py b/tests/diff_tests.py index 950dfa3..1808947 100644 --- a/tests/diff_tests.py +++ b/tests/diff_tests.py @@ -1,7 +1,7 @@ #!/usr/bin/python """Test diff module.""" # -# (C) Pywikibot team, 2016-2020 +# (C) Pywikibot team, 2016-2021 # # Distributed under the terms of the MIT license. from contextlib import suppress @@ -176,7 +176,7 @@ """Test PatchManager.""" for case in self.cases: p = PatchManager(case[0], case[1]) - for key in case[2].keys(): # for each hunk + for key in case[2]: # for each hunk with self.subTest(case=case[0].strip(), key=key): self.assertEqual(p.hunks[key].diff_plain_text, case[2][key])
pywikibot-commits@lists.wikimedia.org