jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/947850 )
Change subject: [IMPR] Remove old code for mw < 1.27 ......................................................................
[IMPR] Remove old code for mw < 1.27
Bug: T306637 Change-Id: I4ba60fa97cae601abbe219d40769d7d374337387 --- M pywikibot/data/api/_paraminfo.py M tests/api_tests.py 2 files changed, 24 insertions(+), 36 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api/_paraminfo.py b/pywikibot/data/api/_paraminfo.py index 1097c00..4112919 100644 --- a/pywikibot/data/api/_paraminfo.py +++ b/pywikibot/data/api/_paraminfo.py @@ -102,8 +102,7 @@ self.paraminfo_keys = frozenset(['modules'])
# Assume that by v1.26, it will be desirable to prefetch 'query' - if mw_ver > '1.26': - self.preloaded_modules |= {'query'} + self.preloaded_modules |= {'query'}
self._fetch(self.preloaded_modules)
@@ -299,40 +298,21 @@ """Check and generate submodules for the given module.""" parameters = self._paraminfo[module].get('parameters', []) submodules = set() - # Advanced submodule into added to MW API in df80f1ea - if self.site.mw_version >= '1.26wmf9': - # This is supplying submodules even if they aren't submodules - # of the given module so skip those - for param in parameters: - if module == 'main' and param['name'] == 'format' \ - or 'submodules' not in param: - continue
- for submodule in param['submodules'].values(): - if '+' in submodule: - parent, child = submodule.rsplit('+', 1) - else: - parent, child = 'main', submodule - if parent == module: - submodules.add(child) - else: - # Boolean submodule info added to MW API in afa153ae - if self.site.mw_version < '1.24wmf18': - if module == 'main': - params = {'action'} - elif module == 'query': - params = {'prop', 'list', 'meta'} + # This is supplying submodules even if they aren't submodules + # of the given module so skip those + for param in parameters: + if module == 'main' and param['name'] == 'format' \ + or 'submodules' not in param: + continue + + for submodule in param['submodules'].values(): + if '+' in submodule: + parent, child = submodule.rsplit('+', 1) else: - params = set() - for param in parameters: - if param['name'] in params: - param['submodules'] = '' - - for param in parameters: - # Do not add format modules - if 'submodules' in param \ - and (module != 'main' or param['name'] != 'format'): - submodules |= set(param['type']) + parent, child = 'main', submodule + if parent == module: + submodules.add(child)
if submodules: self._add_submodules(module, submodules) diff --git a/tests/api_tests.py b/tests/api_tests.py index dbffb21..edbae80 100755 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -22,7 +22,6 @@ DefaultDrySiteTestCase, DefaultSiteTestCase, TestCase, - require_version, ) from tests.utils import FakeLoginManager
@@ -293,7 +292,6 @@
self.assertIn('query+revisions', pi.prefix_map)
- @require_version('>=1.25wmf4', 'support the new paraminfo api') def test_new_mode(self): """Test the new modules-only mode explicitly.""" site = self.get_site()
pywikibot-commits@lists.wikimedia.org