Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269682

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


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/82/269682/1

diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index 66824e5..00d2c08 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: newchange
Gerrit-Change-Id: If4ab0092f4542c341a3515b530360cf048b29572
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <i...@gno.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to