jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/572416 )
Change subject: [cleanup] Remove pre mw 1.14 code ......................................................................
[cleanup] Remove pre mw 1.14 code
Pywikibot supports mw 1.14+ https://www.mediawiki.org/wiki/Manual:Pywikibot/Overview
- remove pre mw 1.14 code found in api.ParamInfo.parameter() - check whether 'parameters'in module only once
Change-Id: I66f00d28c205d2bb1dcf6071592b75d544f02f5c --- M pywikibot/data/api.py 1 file changed, 6 insertions(+), 9 deletions(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index 2c1262f..0702d38 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -695,11 +695,12 @@ except KeyError: raise ValueError("paraminfo for '%s' not loaded" % module)
- if 'parameters' not in module: - pywikibot.warning("module '%s' has no parameters" % module) - return + try: + params = module['parameters'] + except KeyError: + pywikibot.warning("module '{}' has no parameters".format(module)) + return None
- params = module['parameters'] param_data = [param for param in params if param['name'] == param_name]
@@ -707,11 +708,7 @@ return None
assert(len(param_data) == 1) - param_data = param_data[0] - # pre 1.14 doesn't provide limit attribute on parameters - if 'multi' in param_data and 'limit' not in param_data: - param_data['limit'] = self._limit - return param_data + return param_data[0]
@property @deprecated('submodules() or module_paths', since='20150715')
pywikibot-commits@lists.wikimedia.org