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) -- To view, visit https://gerrit.wikimedia.org/r/269682 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If4ab0092f4542c341a3515b530360cf048b29572 Gerrit-PatchSet: 2 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Xqt <i...@gno.de> Gerrit-Reviewer: John Vandenberg <jay...@gmail.com> Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com> Gerrit-Reviewer: Merlijn van Deen <valhall...@arctus.nl> Gerrit-Reviewer: Ricordisamoa <ricordisa...@openmailbox.org> Gerrit-Reviewer: XZise <commodorefabia...@gmx.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits