jenkins-bot has submitted this change and it was merged.
Change subject: [IMPR] Simplify arg parsing in handle_args method ......................................................................
[IMPR] Simplify arg parsing in handle_args method
- avoid length checking logic per argument
Change-Id: If4ab0092f4542c341a3515b530360cf048b29572 --- M scripts/blockpageschecker.py 1 file changed, 9 insertions(+), 11 deletions(-)
Approvals: Ladsgroup: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py index 66824e5..3cb004b 100755 --- a/scripts/blockpageschecker.py +++ b/scripts/blockpageschecker.py @@ -228,21 +228,19 @@
# Process local args for arg in local_args: - if arg == '-always': + option, sep, value = arg.partition(':') + if option == '-always': always = True - elif arg == '-move': + elif option == '-move': moveBlockCheck = True - elif arg == '-show': + elif option == '-show': show = True - elif arg.startswith('-protectedpages'): + elif option in ('-protectedpages', '-moveprotected'): protectedpages = True - if len(arg) > 15: - namespace = int(arg[16:]) - elif arg.startswith('-moveprotected'): - protectedpages = True - protectType = 'move' - if len(arg) > 14: - namespace = int(arg[15:]) + if option == '-moveprotected': + protectType = 'move' + if value: + namespace = int(value) else: genFactory.handleArg(arg)
pywikibot-commits@lists.wikimedia.org