Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P7322
T122763 (2)
Active
Public
Actions
Authored by
Dalba
on Jul 1 2018, 11:03 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F23174356: T122763 (2)
Jul 1 2018, 11:03 AM
2018-07-01 11:03:05 (UTC+0)
Subscribers
None
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index c305dda8..cf7df7a0 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -555,6 +555,8 @@ class ParamInfo(Container):
# query modules can be prefixed with 'query+'
self._init()
+ modules = self._modules_to_set(modules)
+
if self._action_modules:
# The query module may be added before the action modules have been
if 'query' in self._modules:
@@ -735,12 +737,21 @@ class ParamInfo(Container):
assert param['name'] == 'generator' and \
submodules >= set(param['type'])
- def _normalize_modules(self, modules):
- """Add query+ to any query module name not also in action modules."""
- # Users will supply the wrong type, and expect it to work.
+ @staticmethod
+ def _modules_to_set(modules):
+ """Return modules as a set.
+
+ @type modules: Iterable, basestring, set
+ @rtype: set
+ """
+ if isinstance(modules, set):
+ return modules
if isinstance(modules, basestring):
- modules = set(modules.split('|'))
+ return set(modules.split('|'))
+ return set(modules)
+ def _normalize_modules(self, modules):
+ """Add query+ to any query module name not also in action modules."""
assert(self._action_modules)
return {'query+' + mod
@@ -759,7 +770,7 @@ class ParamInfo(Container):
@rtype: set
"""
self._init()
- return self._normalize_modules(modules)
+ return self._normalize_modules(self._modules_to_set(modules))
@classmethod
def normalize_paraminfo(cls, data):
Event Timeline
Dalba
created this paste.
Jul 1 2018, 11:03 AM
2018-07-01 11:03:05 (UTC+0)
Log In to Comment