jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/758079 )

Change subject: refactor old_cat_title, new_cat_title
......................................................................

refactor old_cat_title, new_cat_title

remove from_given, to_given

Change-Id: I655cad2a64609015ce9449ef6f5e942f28924086
---
M scripts/category.py
1 file changed, 7 insertions(+), 10 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/category.py b/scripts/category.py
index 09198b1..c396b09 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -1402,9 +1402,8 @@
     :param args: command line arguments.
     """
     options = {}
-    from_given = False
     old_cat_title = None
-    to_given = False
+    new_cat_title = None
     batch = False
     summary = ''
     inplace = False
@@ -1456,10 +1455,8 @@
             rebuild = True
         elif option == 'from':
             old_cat_title = value.replace('_', ' ')
-            from_given = True
         elif option == 'to':
             new_cat_title = value.replace('_', ' ')
-            to_given = True
         elif option == 'batch':
             batch = True
         elif option == 'inplace':
@@ -1517,7 +1514,7 @@
     cat_db = CategoryDatabase(rebuild=rebuild)

     if action == 'add':
-        if not to_given:
+        if not new_cat_title:
             new_cat_title = pywikibot.input(
                 'Category to add (do not give namespace):')
         gen = gen_factory.getCombinedGenerator()
@@ -1535,7 +1532,7 @@
                              comment=summary,
                              follow_redirects=follow_redirects)
     elif action == 'remove':
-        if not from_given:
+        if not old_cat_title:
             old_cat_title = pywikibot.input('Please enter the name of the '
                                             'category that should be removed:')
         bot = CategoryMoveRobot(oldcat=old_cat_title,
@@ -1548,10 +1545,10 @@
                                 pagesonly=pagesonly,
                                 deletion_comment=use_deletion_summary)
     elif action == 'move':
-        if not from_given:
+        if not old_cat_title:
             old_cat_title = pywikibot.input(
                 'Please enter the old name of the category:')
-        if not to_given:
+        if not new_cat_title:
             new_cat_title = pywikibot.input(
                 'Please enter the new name of the category:')
         if use_deletion_summary:
@@ -1585,10 +1582,10 @@
             '\nor press enter to simply show the tree:')
         bot = CategoryTreeRobot(cat_title, cat_db, filename, depth)
     elif action == 'listify':
-        if not from_given:
+        if not old_cat_title:
             old_cat_title = pywikibot.input(
                 'Please enter the name of the category to listify:')
-        if not to_given:
+        if not new_cat_title:
             new_cat_title = pywikibot.input(
                 'Please enter the name of the list to create:')
         bot = CategoryListifyRobot(old_cat_title, new_cat_title, summary,

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/758079
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I655cad2a64609015ce9449ef6f5e942f28924086
Gerrit-Change-Number: 758079
Gerrit-PatchSet: 2
Gerrit-Owner: Costa Shul <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to