jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/655900 )
Change subject: Renamed handleArg() method to handle_arg() in certain scripts
......................................................................
Renamed handleArg() method to handle_arg() in certain scripts
Bug: T271437
Change-Id: Ib2431deb7c6846b77d5ce53f1031643ea7ae857c
---
M pywikibot/pagegenerators.py
M scripts/add_text.py
M scripts/basic.py
M scripts/blockpageschecker.py
M scripts/category.py
M scripts/change_pagelang.py
M scripts/claimit.py
M scripts/clean_sandbox.py
M scripts/commons_link.py
M scripts/commonscat.py
M scripts/coordinate_import.py
M scripts/cosmetic_changes.py
M scripts/create_categories.py
M scripts/data_ingestion.py
M scripts/delete.py
M scripts/fixing_redirects.py
M scripts/harvest_template.py
M scripts/illustrate_wikidata.py
M scripts/imagecopy.py
19 files changed, 43 insertions(+), 38 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 874127d..b2b9a22 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -1179,7 +1179,7 @@
'Invalid -logevents parameter "{0}"'.format(params[0]))
return self._parse_log_events(*params)
- def handleArg(self, arg: str) -> bool:
+ def handle_arg(self, arg: str) -> bool:
"""Parse one argument at a time.
If it is recognized as an argument that specifies a generator, a
@@ -1213,6 +1213,11 @@
return False
+ @deprecated('handle_arg', since='20210113', future_warning=True)
+ def handleArg(self, arg: str):
+ """DEPRECATED. Use handle_arg()."""
+ return self.handle_arg(arg)
+
def _int_none(v):
"""Return None if v is None or '' else return int(v)."""
diff --git a/scripts/add_text.py b/scripts/add_text.py
index 501f329..895d208 100755
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -313,7 +313,7 @@
issue_deprecation_warning(arg, new_arg,
2, ArgumentDeprecationWarning,
since='20201224')
- genFactory.handleArg(new_arg)
+ genFactory.handle_arg(new_arg)
elif option == '-up':
up = True
elif option == '-noreorder':
@@ -323,7 +323,7 @@
elif option in ('-talk', '-talkpage'):
talkPage = True
else:
- genFactory.handleArg(arg)
+ genFactory.handle_arg(arg)
if textfile and not addText:
with codecs.open(textfile, 'r', config.textfile_encoding) as f:
diff --git a/scripts/basic.py b/scripts/basic.py
index 4645978..477b255 100755
--- a/scripts/basic.py
+++ b/scripts/basic.py
@@ -43,7 +43,7 @@
¶ms;
"""
#
-# (C) Pywikibot team, 2006-2020
+# (C) Pywikibot team, 2006-2021
#
# Distributed under the terms of the MIT license.
#
@@ -161,7 +161,7 @@
for arg in local_args:
# Catch the pagegenerators options
- if gen_factory.handleArg(arg):
+ if gen_factory.handle_arg(arg):
continue # nothing to do here
# Now pick up your own options
diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index 0514a63..62de8be 100755
--- a/scripts/blockpageschecker.py
+++ b/scripts/blockpageschecker.py
@@ -41,7 +41,7 @@
"""
#
-# (C) Pywikibot team, 2007-2020
+# (C) Pywikibot team, 2007-2021
#
# Distributed under the terms of the MIT license.
#
@@ -241,7 +241,7 @@
if value:
namespace = int(value)
else:
- genFactory.handleArg(arg)
+ genFactory.handle_arg(arg)
if config.mylang not in project_inserted:
pywikibot.output('Your project is not supported by this script.\n'
diff --git a/scripts/category.py b/scripts/category.py
index a0f86dd..d59fd5a 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -1416,7 +1416,7 @@
elif option == 'prefix':
prefix = value
else:
- gen_factory.handleArg(arg)
+ gen_factory.handle_arg(arg)
bot = None
@@ -1429,7 +1429,7 @@
'Category to add (do not give namespace):')
if not gen:
# default for backwards compatibility
- gen_factory.handleArg('-links')
+ gen_factory.handle_arg('-links')
gen = gen_factory.getCombinedGenerator()
# The preloading generator is responsible for downloading multiple
# pages from the wiki simultaneously.
diff --git a/scripts/change_pagelang.py b/scripts/change_pagelang.py
index 4060c7b..0b8e544 100755
--- a/scripts/change_pagelang.py
+++ b/scripts/change_pagelang.py
@@ -18,7 +18,7 @@
the one set in -setlang (keep the current language).
"""
#
-# (C) Pywikibot team, 2018-2020
+# (C) Pywikibot team, 2018-2021
#
# Distributed under the terms of the MIT license.
#
@@ -141,7 +141,7 @@
elif arg in ('-always', '-never'):
options[opt[1:]] = True
else:
- gen_factory.handleArg(arg)
+ gen_factory.handle_arg(arg)
if not options.get('setlang'):
pywikibot.error('No -setlang parameter given.')
diff --git a/scripts/claimit.py b/scripts/claimit.py
index 58652da..0e30a11 100755
--- a/scripts/claimit.py
+++ b/scripts/claimit.py
@@ -47,7 +47,7 @@
"""
#
-# (C) Pywikibot team, 2013-2020
+# (C) Pywikibot team, 2013-2021
#
# Distributed under the terms of the MIT license.
#
@@ -123,7 +123,7 @@
exists_arg = arg.split(':')[1]
continue
# Handle page generator args
- if gen.handleArg(arg):
+ if gen.handle_arg(arg):
continue
commandline_claims.append(arg)
if len(commandline_claims) % 2:
diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py
index 6522866..4b9c0c6 100755
--- a/scripts/clean_sandbox.py
+++ b/scripts/clean_sandbox.py
@@ -38,7 +38,7 @@
delay: 7
"""
#
-# (C) Pywikibot team, 2006-2020
+# (C) Pywikibot team, 2006-2021
#
# Distributed under the terms of the MIT license.
#
@@ -285,7 +285,7 @@
elif opt == 'summary':
opts[opt] = value or pywikibot.input('Enter the summary:')
else:
- gen_factory.handleArg(arg)
+ gen_factory.handle_arg(arg)
generator = gen_factory.getCombinedGenerator()
diff --git a/scripts/commons_link.py b/scripts/commons_link.py
index dccd99c..29ca5b2 100755
--- a/scripts/commons_link.py
+++ b/scripts/commons_link.py
@@ -23,7 +23,7 @@
¶ms;
"""
#
-# (C) Pywikibot team, 2006-2020
+# (C) Pywikibot team, 2006-2021
#
# Distributed under the terms of the MIT license.
#
@@ -133,7 +133,7 @@
elif arg == '-always':
options['always'] = True
else:
- gen_factory.handleArg(arg)
+ gen_factory.handle_arg(arg)
gen = gen_factory.getCombinedGenerator(preload=True)
if pywikibot.bot.suggest_help(missing_action='action' not in options,
diff --git a/scripts/commonscat.py b/scripts/commonscat.py
index 1ef48f1..39a6708 100755
--- a/scripts/commonscat.py
+++ b/scripts/commonscat.py
@@ -35,7 +35,7 @@
# *Found one template. Add this template
# *Found more templates. Ask the user <- still have to implement this
#
-# (C) Pywikibot team, 2008-2020
+# (C) Pywikibot team, 2008-2021
#
# Distributed under the terms of the MIT license.
#
@@ -523,7 +523,7 @@
elif option == 'always':
options[option] = True
else:
- genFactory.handleArg(arg)
+ genFactory.handle_arg(arg)
if checkcurrent:
site = pywikibot.Site()
diff --git a/scripts/coordinate_import.py b/scripts/coordinate_import.py
index 758b9f2..51527ec 100755
--- a/scripts/coordinate_import.py
+++ b/scripts/coordinate_import.py
@@ -37,7 +37,7 @@
¶ms;
"""
#
-# (C) Pywikibot team, 2013-2020
+# (C) Pywikibot team, 2013-2021
#
# Distributed under the terms of MIT License.
#
@@ -163,7 +163,7 @@
create_new = False
for arg in local_args:
- if generator_factory.handleArg(arg):
+ if generator_factory.handle_arg(arg):
continue
if arg == '-create':
create_new = True
diff --git a/scripts/cosmetic_changes.py b/scripts/cosmetic_changes.py
index 601eff1..c140cb0 100644
--- a/scripts/cosmetic_changes.py
+++ b/scripts/cosmetic_changes.py
@@ -28,7 +28,7 @@
For further information see pywikibot/cosmetic_changes.py
"""
#
-# (C) Pywikibot team, 2006-2020
+# (C) Pywikibot team, 2006-2021
#
# Distributed under the terms of the MIT license.
#
@@ -114,7 +114,7 @@
raise ValueError(
'Unknown ignore mode "{0}"!'.format(ignore_mode))
else:
- gen_factory.handleArg(arg)
+ gen_factory.handle_arg(arg)
site = pywikibot.Site()
diff --git a/scripts/create_categories.py b/scripts/create_categories.py
index 7d68442..a7c9c61 100755
--- a/scripts/create_categories.py
+++ b/scripts/create_categories.py
@@ -31,7 +31,7 @@
to create [[Category:Cultural heritage monuments in Hensies]].
"""
#
-# (c) Pywikibot team, 2011-2020
+# (c) Pywikibot team, 2011-2021
#
# Distributed under the terms of the MIT license.
#
@@ -117,7 +117,7 @@
if value:
options[opt] = value
else:
- gen_factory.handleArg(arg)
+ gen_factory.handle_arg(arg)
missing = ['-' + arg for arg in ('basename', 'parent')
if arg not in options]
diff --git a/scripts/data_ingestion.py b/scripts/data_ingestion.py
index d4ce7ad..e526b92 100755
--- a/scripts/data_ingestion.py
+++ b/scripts/data_ingestion.py
@@ -94,7 +94,7 @@
"""
#
-# (C) Pywikibot team, 2012-2020
+# (C) Pywikibot team, 2012-2021
#
# Distributed under the terms of the MIT license.
#
@@ -326,7 +326,7 @@
if arg.startswith('-csvdir:'):
csv_dir = arg[8:]
else:
- genFactory.handleArg(arg)
+ genFactory.handle_arg(arg)
config_generator = genFactory.getCombinedGenerator()
diff --git a/scripts/delete.py b/scripts/delete.py
index b5d001c..ed2c0ae 100755
--- a/scripts/delete.py
+++ b/scripts/delete.py
@@ -52,7 +52,7 @@
python pwb.py delete -cat:"To delete" -always
"""
#
-# (C) Pywikibot team, 2013-2020
+# (C) Pywikibot team, 2013-2021
#
# Distributed under the terms of the MIT license.
#
@@ -259,7 +259,7 @@
namespaces = mysite.namespaces
options['orphansonly'] = namespaces
else:
- gen_factory.handleArg(arg)
+ gen_factory.handle_arg(arg)
found = arg.find(':') + 1
if found:
page_name = arg[found:]
diff --git a/scripts/fixing_redirects.py b/scripts/fixing_redirects.py
index d272888..179b109 100755
--- a/scripts/fixing_redirects.py
+++ b/scripts/fixing_redirects.py
@@ -10,7 +10,7 @@
¶ms;
"""
#
-# (C) Pywikibot team, 2004-2020
+# (C) Pywikibot team, 2004-2021
#
# Distributed under the terms of the MIT license.
#
@@ -200,7 +200,7 @@
for arg in local_args:
if arg == '-featured':
featured = True
- elif genFactory.handleArg(arg):
+ elif genFactory.handle_arg(arg):
pass
mysite = pywikibot.Site()
diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py
index e213c79..e96cbfc 100755
--- a/scripts/harvest_template.py
+++ b/scripts/harvest_template.py
@@ -88,7 +88,7 @@
-multi
"""
#
-# (C) Pywikibot team, 2013-2020
+# (C) Pywikibot team, 2013-2021
#
# Distributed under the terms of MIT License.
#
@@ -379,7 +379,7 @@
template_title = arg[10:]
elif arg.startswith('-create'):
options['create'] = True
- elif gen.handleArg(arg):
+ elif gen.handle_arg(arg):
if arg.startswith('-transcludes:'):
template_title = arg[13:]
else:
@@ -421,7 +421,7 @@
generator = gen.getCombinedGenerator(preload=True)
if not generator:
- gen.handleArg('-transcludes:' + template_title)
+ gen.handle_arg('-transcludes:' + template_title)
generator = gen.getCombinedGenerator(preload=True)
bot = HarvestRobot(generator, template_title, fields, **options)
diff --git a/scripts/illustrate_wikidata.py b/scripts/illustrate_wikidata.py
index 117cff7..5567304 100755
--- a/scripts/illustrate_wikidata.py
+++ b/scripts/illustrate_wikidata.py
@@ -14,7 +14,7 @@
¶ms;
"""
#
-# (C) Pywikibot team, 2013-2020
+# (C) Pywikibot team, 2013-2021
#
# Distributed under the terms of MIT License.
#
@@ -103,7 +103,7 @@
else:
wdproperty = arg[10:]
else:
- generator_factory.handleArg(arg)
+ generator_factory.handle_arg(arg)
generator = generator_factory.getCombinedGenerator(preload=True)
if not generator:
diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py
index ae631b4..547c0f0 100644
--- a/scripts/imagecopy.py
+++ b/scripts/imagecopy.py
@@ -57,7 +57,7 @@
By default the bot works on your home wiki (set in user-config)
"""
#
-# (C) Pywikibot team, 2003-2020
+# (C) Pywikibot team, 2003-2021
#
# Distributed under the terms of the MIT license.
#
@@ -505,7 +505,7 @@
elif arg == '-delete':
delete_after_done = True
else:
- genFactory.handleArg(arg)
+ genFactory.handle_arg(arg)
pregenerator = genFactory.getCombinedGenerator(preload=True)
if not pregenerator:
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/655900
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: Ib2431deb7c6846b77d5ce53f1031643ea7ae857c
Gerrit-Change-Number: 655900
Gerrit-PatchSet: 4
Gerrit-Owner: Homeboy 445 <[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]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits