jenkins-bot has submitted this change and it was merged.
Change subject: Fix spelling mistake in prompt
......................................................................
Fix spelling mistake in prompt
Change-Id: I5088154e31376798e964dfc8025c6727bbd46991
---
M scripts/welcome.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
Whym: Looks good to me, but someone else must approve
diff --git a/scripts/welcome.py b/scripts/welcome.py
index 45ac857..8e4995a 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -917,7 +917,7 @@
elif arg.startswith('-timeoffset'):
if len(arg) == 11:
globalvar.timeoffset = int(pywikibot.input(
- u'Which time offset (in minutest) for new users would you like to use?'))
+ 'Which time offset (in minutes) for new users would you like to use?'))
else:
globalvar.timeoffset = int(arg[12:])
elif arg.startswith('-time'):
--
To view, visit https://gerrit.wikimedia.org/r/257849
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5088154e31376798e964dfc8025c6727bbd46991
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Whym <whym(a)whym.org>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Rename -time into -sleep
......................................................................
Rename -time into -sleep
Bug: T120894
Change-Id: Icb8c97a836ac21ac685fd445622ec2b3d8daf499
---
M scripts/checkimages.py
1 file changed, 13 insertions(+), 6 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 762f6d6..1265920 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -29,7 +29,9 @@
-break To break the bot after the first check (default: recursive)
--time[:#] Time in seconds between repeat runs (default: 30)
+-sleep[:#] Time in seconds between repeat runs (default: 30)
+
+-time[:#] The -time option is deprecated. Use -sleep instead.
-wait[:#] Wait x second before check the images (default: 0)
@@ -1600,12 +1602,17 @@
u'How many files do you want to check?'))
else:
limit = int(arg[7:])
- if arg.startswith('-time'):
- if len(arg) == 5:
- time_sleep = int(pywikibot.input(
- u'How many seconds do you want runs to be apart?'))
+ if arg.startswith('-sleep') or arg.startswith('-time'):
+ if arg.startswith('-sleep'):
+ length = len('-sleep')
else:
- time_sleep = int(arg[6:])
+ pywikibot.tools.issue_deprecation_warning('-time', '-sleep', 2)
+ length = len('-time')
+ if len(arg) == length:
+ time_sleep = int(pywikibot.input(
+ 'How many seconds do you want runs to be apart?'))
+ else:
+ time_sleep = int(arg[length + 1:])
elif arg == '-break':
repeat = False
elif arg == '-nologerror':
--
To view, visit https://gerrit.wikimedia.org/r/257822
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icb8c97a836ac21ac685fd445622ec2b3d8daf499
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Murfel <murnatty(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: No longer shows execution time if bot was not running
......................................................................
No longer shows execution time if bot was not running
Bug: T70613
Change-Id: I2a17f2f4f05a8b134237ccd5037ba02e42c6e1bc
---
M scripts/checkimages.py
1 file changed, 6 insertions(+), 5 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
XZise: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 762f6d6..f351fef 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1700,7 +1700,7 @@
if site.code not in project_inserted:
pywikibot.output(u"Your project is not supported by this script.\n"
u"You have to edit the script and add it!")
- return
+ return False
# Reading the log of the new images if another generator is not given.
if normal:
@@ -1764,10 +1764,11 @@
if __name__ == "__main__":
start = time.time()
try:
- main()
+ ret = main()
except SystemExit:
pass
else:
- final = time.time()
- delta = int(final - start)
- pywikibot.output("Execution time: %s seconds\n" % delta)
+ if ret is not False:
+ final = time.time()
+ delta = int(final - start)
+ pywikibot.output("Execution time: %s seconds\n" % delta)
--
To view, visit https://gerrit.wikimedia.org/r/257850
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2a17f2f4f05a8b134237ccd5037ba02e42c6e1bc
Gerrit-PatchSet: 9
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Georggi199 <bmp2558(a)gmail.com>
Gerrit-Reviewer: Hashar <hashar(a)free.fr>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Nemo bis <federicoleva(a)tiscali.it>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Deprecate page.isEmpty() and add function in interwiki to check for empty pages
......................................................................
Deprecate page.isEmpty() and add function in interwiki to check for empty pages
The change allows interwiki.py to have its own 'page_empty_check' function which
can be optimized further rather than use page.isEmpty() which is used by other
tools and hence can't be changed
Bug: T112340
Change-Id: I3070efc8dd568b6817e65be880e92974feb084ce
---
M pywikibot/page.py
M scripts/interwiki.py
2 files changed, 28 insertions(+), 6 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index bdcc0b1..dc34774 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -746,6 +746,7 @@
return Category(Link(self._catredirect, self.site))
raise pywikibot.IsNotRedirectPage(self)
+ @deprecated("interwiki.page_empty_check(page)")
def isEmpty(self):
"""Return True if the page text has less than 4 characters.
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index fb20f58..dcd2095 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -1372,7 +1372,7 @@
# must be behind the page.isRedirectPage() part
# otherwise a redirect error would be raised
- elif not page.isCategory() and page.isEmpty():
+ elif page_empty_check(page):
globalvar.remove.append(unicode(page))
if not globalvar.quiet:
pywikibot.output(u"NOTE: %s is empty. Skipping." % page)
@@ -1839,7 +1839,7 @@
except pywikibot.NoPage:
pywikibot.output(u"Not editing %s: page does not exist" % page)
raise SaveError(u'Page doesn\'t exist')
- if not page.isCategory() and page.isEmpty():
+ if page_empty_check(page):
pywikibot.output(u"Not editing %s: page is empty" % page)
raise SaveError(u'Page is empty.')
@@ -2196,10 +2196,6 @@
if page.isTalkPage():
pywikibot.output(u'Skipping: %s is a talk page' % page)
continue
- # doesn't work: page must be preloaded for this test
- # if page.isEmpty():
- # pywikibot.output(u'Skipping: %s is a empty page' % page.title())
- # continue
if page.namespace() == 10:
loc = None
try:
@@ -2458,6 +2454,31 @@
bot.add(page, hints=hintStrings)
+def page_empty_check(page):
+ """
+ Return True if page should be skipped as it is almost empty.
+
+ Pages in content namespaces are considered empty if they contain less than 50
+ characters, and other pages are considered empty if they are not category
+ pages and contain less than 4 characters excluding interlanguage links and
+ categories.
+
+ @rtype: bool
+ """
+ # Check if the page is in content namespace
+ if page.namespace() == 0:
+ # Check if the page contains at least 50 characters
+ return len(page.text) < 50
+ else:
+ if not page.isCategory():
+ txt = page.get()
+ txt = textlib.removeLanguageLinks(txt, site=page.site)
+ txt = textlib.removeCategoryLinks(txt, site=page.site)
+ return len(txt) < 4
+ else:
+ return False
+
+
def main(*args):
"""
Process command line arguments and invoke bot.
--
To view, visit https://gerrit.wikimedia.org/r/257367
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3070efc8dd568b6817e65be880e92974feb084ce
Gerrit-PatchSet: 5
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Vadiraja.k <vadi.fedx(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [IMPROV] Remove unnecessary variable definitions
......................................................................
[IMPROV] Remove unnecessary variable definitions
Defining a function locale variable directly before a `return` statement which
is not using that variable is unnecessary.
Change-Id: Idf623fad2498a0395b8b40a6bc2b78bba15fc412
---
M scripts/checkimages.py
1 file changed, 0 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 0e752e5..762f6d6 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1532,7 +1532,6 @@
# Here begins the check block.
if brackets and license_found:
# It works also without this... but i want only to be sure ^^
- brackets = False
return True
elif delete:
pywikibot.output(u"%s is not a file!" % self.imageName)
@@ -1542,7 +1541,6 @@
notification = din % self.imageName
head = dih
self.report(canctext, self.imageName, notification, head)
- delete = False
return True
elif self.imageCheckText in nothing:
pywikibot.output(
--
To view, visit https://gerrit.wikimedia.org/r/256411
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idf623fad2498a0395b8b40a6bc2b78bba15fc412
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>