jenkins-bot has submitted this change and it was merged.
Change subject: unusedfiles.py: allow to specify number of unused files
......................................................................
unusedfiles.py: allow to specify number of unused files
Allow to specify total parameter in unusedfiles.py.
Bug: T145854
Change-Id: I3eb055232f5582602a7ff5082565921507a22f49
---
M scripts/unusedfiles.py
1 file changed, 17 insertions(+), 8 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py
index 0c19ec7..3bb027a 100755
--- a/scripts/unusedfiles.py
+++ b/scripts/unusedfiles.py
@@ -7,6 +7,9 @@
-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
+ n is the maximum number of articles to work on.
+ If not used, all pages are used.
"""
#
# (C) Leonardo Gregianin, 2007
@@ -57,11 +60,6 @@
(self.template_user or self.getOption('nouserwarning'))):
raise pywikibot.Error(u'This script is not localized for %s site.'
% self.site)
-
- generator = pagegenerators.UnusedFilesGenerator(site=self.site)
- generator = pagegenerators.PreloadingGenerator(generator)
-
- self.generator = generator
def treat(self, image):
"""Process one image page."""
@@ -114,11 +112,22 @@
@type args: list of unicode
"""
options = {}
+ total = None
- for arg in pywikibot.handle_args(args):
- options[arg[1:]] = True
+ local_args = pywikibot.handle_args(args)
- bot = UnusedFilesBot(pywikibot.Site(), **options)
+ for arg in local_args:
+ arg, sep, value = arg.partition(':')
+ if arg == '-total':
+ total = value
+ else:
+ options[arg[1:]] = True
+
+ site = pywikibot.Site()
+ gen = pagegenerators.UnusedFilesGenerator(total=total, site=site)
+ gen = pagegenerators.PreloadingGenerator(gen)
+
+ bot = UnusedFilesBot(site, generator=gen, **options)
try:
bot.run()
except pywikibot.Error as e:
--
To view, visit https://gerrit.wikimedia.org/r/313115
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3eb055232f5582602a7ff5082565921507a22f49
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #3636
Status: Errored
Duration: 33 minutes and 47 seconds
Commit: ac27a20 (master)
Author: ayushjain19
Message: Suppressed sleep message using noisysleep in user-config
The "Waiting for 7 pages to be put. Estimated time remaining:
0:01:10 ***" message will now appear only when "Estimated
time remaining" in more than noisysleep.
Bug: T124012
Change-Id: Ib0173c131d13ed00ea2b51cd9254d5fc1131b655
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/499e9261c1c5...ac27a20e…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/162705049
--
You can configure recipients for build notifications in your .travis.yml file. See https://docs.travis-ci.com/user/notifications
jenkins-bot has submitted this change and it was merged.
Change subject: Suppressed sleep message using noisysleep in user-config
......................................................................
Suppressed sleep message using noisysleep in user-config
The "Waiting for 7 pages to be put. Estimated time remaining:
0:01:10 ***" message will now appear only when "Estimated
time remaining" in more than noisysleep.
Bug: T124012
Change-Id: Ib0173c131d13ed00ea2b51cd9254d5fc1131b655
---
M pywikibot/__init__.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 70771dd..37f03bb 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -902,7 +902,7 @@
page_put_queue.put((None, [], {}))
num, sec = remaining()
- if num > 0:
+ if num > 0 and sec.total_seconds() > config.noisysleep:
output(color_format(
'{lightblue}Waiting for {num} pages to be put. '
'Estimated time remaining: {sec}{default}', num=num, sec=sec))
--
To view, visit https://gerrit.wikimedia.org/r/312727
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib0173c131d13ed00ea2b51cd9254d5fc1131b655
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ayushjain19 <ayushjain081(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>