jenkins-bot has submitted this change and it was merged.
Change subject: simplify operation argument handling ......................................................................
simplify operation argument handling
Change-Id: Iec03c0257b9fe472f911bde93a4ea0cd00be3e70 --- M scripts/templatecount.py 1 file changed, 5 insertions(+), 9 deletions(-)
Approvals: John Vandenberg: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/templatecount.py b/scripts/templatecount.py index 93a8cac..a3dceb2 100644 --- a/scripts/templatecount.py +++ b/scripts/templatecount.py @@ -31,7 +31,7 @@ """ # # (c) Pywikibot team, 2006-2014 -# (c) xqt, 2009-2013 +# (c) xqt, 2009-2014 # # Distributed under the terms of the MIT license. # @@ -113,10 +113,8 @@ namespaces = []
for arg in pywikibot.handleArgs(): - if arg == '-count': - operation = "Count" - elif arg == '-list': - operation = "List" + if arg in ('-count', '-list'): + operation = arg[1:] elif arg.startswith('-namespace:'): try: namespaces.append(int(arg[len('-namespace:'):])) @@ -142,12 +140,10 @@ argsList.remove('reflist') elif choice == 'n': return - else: - pass
- if operation == "Count": + if operation == "count": robot.countTemplates(argsList, namespaces) - elif operation == "List": + elif operation == "list": robot.listTemplates(argsList, namespaces)
if __name__ == "__main__":