jenkins-bot merged this change.

View Change

Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
[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(-)

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')

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I66f00d28c205d2bb1dcf6071592b75d544f02f5c
Gerrit-Change-Number: 572416
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Mpaa <mpaa.wiki@gmail.com>
Gerrit-Reviewer: jenkins-bot (75)