jenkins-bot submitted this change.
[IMPR] recurse with depth for CategoryListifyRobot
Add options dict with intention to move all properties there
def articles(self,
recurse: Union[int, bool] = False,
...
:param recurse: if not False or 0, also iterate subcategories of
subcategories. If an int, limit recursion to this number of
levels. (Example: recurse=1 will iterate direct subcats and
first-level sub-sub-cats, but no deeper.)
Change-Id: I39b2d8ef5aeba16a5bb64bfa50c409a7f5e99ec3
---
M scripts/category.py
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/scripts/category.py b/scripts/category.py
index 6de36bd..5e5c3bd 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -83,7 +83,9 @@
-summary: - Pick a custom edit summary for the bot.
-inplace - Use this flag to change categories in place rather than
rearranging them.
- -recurse - Recurse through all subcategories of categories.
+ -recurse[:<depth>]
+ - Recurse through subcategories of the category to
+ optional depth.
-pagesonly - While removing pages from a category, keep the subpage links
and do not remove them.
-match - Only work on pages whose titles match the given regex (for
@@ -909,7 +911,7 @@
overwrite: bool = False,
show_images: bool = False, *,
talk_pages: bool = False,
- recurse: bool = False,
+ recurse: Union[int, bool] = False,
prefix: str = '*',
namespaces=None) -> None:
"""Initializer."""
@@ -1326,6 +1328,7 @@
:param args: command line arguments.
"""
+ options = {}
from_given = False
to_given = False
batch = False
@@ -1335,7 +1338,6 @@
overwrite = False
showimages = False
talkpages = False
- recurse = False
title_regex = None
pagesonly = False
wikibase = True
@@ -1403,7 +1405,7 @@
elif option == 'talkpages':
talkpages = True
elif option == 'recurse':
- recurse = True
+ options[option] = True if value == '' else int(value)
elif option == 'pagesonly':
pagesonly = True
elif option == 'nowb':
@@ -1514,7 +1516,8 @@
'Please enter the name of the list to create:')
bot = CategoryListifyRobot(old_cat_title, new_cat_title, summary,
append, overwrite, showimages,
- talk_pages=talkpages, recurse=recurse,
+ talk_pages=talkpages,
+ recurse=options.get('recurse', False),
prefix=prefix,
namespaces=gen_factory.namespaces)
To view, visit change 748696. To unsubscribe, or for help writing mail filters, visit settings.