jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/484007 )
Change subject: Renamed -total option to -limit at redirect.py and unusedfiles.py
......................................................................
Renamed -total option to -limit at redirect.py and unusedfiles.py
Bug: T148354
Change-Id: I56b04c265e0b62875c338e319b07f71cc5f88f0d
---
M scripts/redirect.py
M scripts/unusedfiles.py
2 files changed, 26 insertions(+), 12 deletions(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/redirect.py b/scripts/redirect.py
index 3c962b4..2d77de4 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -55,7 +55,7 @@
-until:title The possible last page title in each namespace. Page needs not
exist.
--total:n The maximum count of redirects to work upon. If omitted, there
+-limit:n The maximum count of redirects to work upon. If omitted, there
is no limit.
-delete Prompt the user whether broken redirects should be deleted (or
@@ -87,7 +87,9 @@
from pywikibot import i18n, xmlreader
from pywikibot.bot import (OptionHandler, SingleSiteBot, ExistingPageBot,
RedirectPageBot)
+from pywikibot.exceptions import ArgumentDeprecationWarning
from pywikibot.textlib import extract_templates_and_params_regex_simple
+from pywikibot.tools import issue_deprecation_warning
if sys.version_info[0] > 2:
basestring = (str, )
@@ -110,7 +112,7 @@
'offset': -1,
'page': None,
'start': None,
- 'total': None,
+ 'limit': None,
'until': None,
'xml': None,
}
@@ -125,7 +127,7 @@
self.offset = self.getOption('offset')
self.page_title = self.getOption('page')
self.api_start = self.getOption('start')
- self.api_number = self.getOption('total')
+ self.api_number = self.getOption('limit')
self.api_until = self.getOption('until')
self.xmlFilename = self.getOption('xml')
@@ -404,7 +406,7 @@
def __init__(self, action, **kwargs):
"""Initializer."""
self.availableOptions.update({
- 'total': float('inf'),
+ 'limit': float('inf'),
'delete': False,
'sdtemplate': None,
})
@@ -674,8 +676,8 @@
def treat(self, page):
"""Treat a page."""
- if self._treat_counter >= self.getOption('total'):
- pywikibot.output('\nNumber of pages reached the total limit. '
+ if self._treat_counter >= self.getOption('limit'):
+ pywikibot.output('\nNumber of pages reached the limit. '
'Script terminated.')
self.stop()
super(RedirectRobot, self).treat(page)
@@ -710,8 +712,6 @@
action = arg
elif option in ('always', 'delete'):
options[option] = True
- elif option == 'total':
- options[option] = gen_options[option] = int(value)
elif option == 'sdtemplate':
options['sdtemplate'] = value or pywikibot.input(
'Which speedy deletion template to use?')
@@ -742,6 +742,13 @@
gen_options[option] = int(value)
elif option in ('page', 'start', 'until'):
gen_options[option] = value
+ elif option in ('limit', 'total'):
+ option['limit'] = gen_options['limit'] = int(value)
+ if option == 'total':
+ issue_deprecation_warning('The usage of "{0}"'.format(arg),
+ '-limit', 2,
+ ArgumentDeprecationWarning,
+ since='20190120')
else:
pywikibot.output('Unknown argument: ' + arg)
diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py
index d5599da..0d35d55 100755
--- a/scripts/unusedfiles.py
+++ b/scripts/unusedfiles.py
@@ -7,15 +7,15 @@
-always Don't be asked every time.
-nouserwarning Do not warn uploader about orphaned file.
--total Specify number of pages to work on with "-total:n" where
+-limit Specify number of pages to work on with "-limit:n" where
n is the maximum number of articles to work on.
If not used, all pages are used.
"""
#
# (C) Leonardo Gregianin, 2007
# (C) Filnik, 2008
-# (c) xqt, 2011-2018
-# (C) Pywikibot team, 2013-2018
+# (c) xqt, 2011-2019
+# (C) Pywikibot team, 2013-2019
#
# Distributed under the terms of the MIT license.
#
@@ -24,6 +24,8 @@
import pywikibot
from pywikibot import i18n, pagegenerators
from pywikibot.bot import SingleSiteBot, AutomaticTWSummaryBot, ExistingPageBot
+from pywikibot.exceptions import ArgumentDeprecationWarning
+from pywikibot.tools import issue_deprecation_warning
template_to_the_image = {
'meta': '{{Orphan file}}',
@@ -114,8 +116,13 @@
for arg in local_args:
arg, sep, value = arg.partition(':')
- if arg == '-total':
+ if arg == '-limit':
total = value
+ elif arg == '-total':
+ total = value
+ issue_deprecation_warning('The usage of "{0}"'.format(arg),
+ '-limit', 2, ArgumentDeprecationWarning,
+ since='20190120')
else:
options[arg[1:]] = True
--
To view, visit https://gerrit.wikimedia.org/r/484007
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I56b04c265e0b62875c338e319b07f71cc5f88f0d
Gerrit-Change-Number: 484007
Gerrit-PatchSet: 18
Gerrit-Owner: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/486716 )
Change subject: [IMPR] Reduce maximum archive size to 200k
......................................................................
[IMPR] Reduce maximum archive size to 200k
Bug: T214669
Change-Id: I8a3ea71150938a502f91c1d29f5e2ee0dbc7d10d
---
M scripts/archivebot.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, but someone else must approve
Zhuyifei1999: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index 66ac3aa..ed1c0ed 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -42,7 +42,7 @@
variable. Will be actualized by bot. Initial value is 1.
maxarchivesize The maximum archive size before incrementing the counter.
Value can be given with appending letter like K or M
- which indicates KByte or MByte. Default value is 1000M.
+ which indicates KByte or MByte. Default value is 200K.
minthreadsleft Minimum number of threads that should be left on a page.
Default value is 5.
minthreadstoarchive The minimum number of threads to archive at once. Default
@@ -90,7 +90,7 @@
"""
#
# (C) Misza13, 2006-2010
-# (C) xqt, 2009-2018
+# (C) xqt, 2009-2019
# (C) Pywikibot team, 2007-2019
#
# Distributed under the terms of the MIT license.
@@ -520,7 +520,7 @@
('archive', ['', False]),
('algo', ['old(24h)', False]),
('counter', ['1', False]),
- ('maxarchivesize', ['1000M', False]),
+ ('maxarchivesize', ['200K', False]),
])
self.salt = salt
self.force = force
--
To view, visit https://gerrit.wikimedia.org/r/486716
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8a3ea71150938a502f91c1d29f5e2ee0dbc7d10d
Gerrit-Change-Number: 486716
Gerrit-PatchSet: 7
Gerrit-Owner: Mahveotm <mahveotm(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Dvorapa <dvorapa(a)seznam.cz>