jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/488295 )
Change subject: Improve and cleanup archivebot.py
......................................................................
Improve and cleanup archivebot.py
- Raise config errors in more cases.
- Code cleanup.
- Fix typos in docs.
Change-Id: I7efdb5ed7a7b21ae8156eee20e452908d955608f
---
M scripts/archivebot.py
1 file changed, 15 insertions(+), 16 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index ed1c0ed..b8a32b7 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -15,7 +15,7 @@
either basing on the thread's name or then name can contain a counter which
will be incremented when the archive reaches a certain size.
-Trancluded template may contain the following parameters:
+Transcluded template may contain the following parameters:
{{TEMPLATE_PAGE
|archive =
@@ -33,13 +33,13 @@
archive Name of the page to which archived threads will be put.
Must be a subpage of the current page. Variables are
supported.
- algo specifies the maximum age of a thread. Must be
+ algo Specifies the maximum age of a thread. Must be
in the form old(<delay>) where <delay> specifies
the age in seconds (s), hours (h), days (d),
- weeks(w), or years (y) like 24h or 5d. Default is
+ weeks (w), or years (y) like 24h or 5d. Default is
old(24h).
counter The current value of a counter which could be assigned as
- variable. Will be actualized by bot. Initial value is 1.
+ variable. Will be updated 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 200K.
@@ -50,7 +50,7 @@
archiveheader Content that will be put on new archive pages as the
header. This parameter supports the use of variables.
Default value is {{talkarchive}}
- key A secret key that (if valid) allows archives to not be
+ key A secret key that (if valid) allows archives not to be
subpages of the page being archived.
Variables below can be used in the value for "archive" in the template above:
@@ -259,6 +259,8 @@
"""
r = re.search(r'(\d+) *([BkKMT]?)', string)
+ if not r:
+ raise MalformedConfigError("Couldn't parse size: {}".format(string))
val, unit = (int(r.group(1)), r.group(2))
if unit == 'M':
val *= 1024
@@ -463,7 +465,7 @@
# This extra info is not desirable when run under the unittest
# framework, which may be run either directly or via setup.py
if pywikibot.calledModuleName() not in ['archivebot_tests', 'setup']:
- pywikibot.output('{} Threads found on {}'
+ pywikibot.output('{} thread(s) found on {}'
.format(len(self.threads), self))
def feed_thread(self, thread, max_archive_size=(250 * 1024, 'B')):
@@ -579,22 +581,19 @@
raise MissingConfigError('Missing or malformed template')
if not self.get_attr('algo', ''):
raise MissingConfigError('Missing argument "algo" in template')
+ if not self.get_attr('archive', ''):
+ raise MissingConfigError('Missing argument "archive" in template')
def feed_archive(self, archive, thread, max_archive_size, params=None):
"""
Feed the thread to one of the archives.
If it doesn't exist yet, create it.
- If archive name is an empty string (or None),
- discard the thread.
- Also checks for security violations.
+ Also check for security violations.
"""
title = archive.title()
page_title = self.page.title()
- if not title:
- return
- if not (self.force
- or page_title + '/' == title[:len(page_title) + 1]
+ if not (self.force or title.startswith(page_title + '/')
or self.key_ok()):
raise ArchiveSecurityError(
'Archive page {} does not start with page title ({})!'
@@ -609,7 +608,7 @@
arch_counter = int(self.get_attr('counter', '1'))
oldthreads = self.page.threads
self.page.threads = []
- whys = []
+ whys = set()
pywikibot.output('Processing {} threads'.format(len(oldthreads)))
for t in oldthreads:
if len(oldthreads) - self.archived_threads \
@@ -646,11 +645,11 @@
if self.feed_archive(archive, t, max_arch_size, params):
arch_counter += 1
self.set_attr('counter', str(arch_counter))
- whys.append(why)
+ whys.add(why)
self.archived_threads += 1
else:
self.page.threads.append(t)
- return set(whys)
+ return whys
def run(self):
"""Process a single DiscussionPage object."""
--
To view, visit https://gerrit.wikimedia.org/r/488295
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: I7efdb5ed7a7b21ae8156eee20e452908d955608f
Gerrit-Change-Number: 488295
Gerrit-PatchSet: 2
Gerrit-Owner: Matěj Suchánek <matejsuchanek97(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: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/488067 )
Change subject: download_dump: Handle `get_dump_name()` if there are non-number dirnames
......................................................................
download_dump: Handle `get_dump_name()` if there are non-number dirnames
Handle `get_dump_name()` if there are non-number dirnames like
'latest', etc.
Bug: T184032
Change-Id: If0a39ab4e5f080ebe1963d61c9c9a6f6cdb11574
---
M scripts/maintenance/download_dump.py
1 file changed, 3 insertions(+), 1 deletion(-)
Approvals:
ArielGlenn: Looks good to me, but someone else must approve
Dvorapa: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/maintenance/download_dump.py b/scripts/maintenance/download_dump.py
index 8347a7a..66c96fc 100644
--- a/scripts/maintenance/download_dump.py
+++ b/scripts/maintenance/download_dump.py
@@ -66,7 +66,9 @@
"""Check if dump file exists locally in a Toolforge server."""
db_path = '/public/dumps/public/{0}/'.format(db_name)
if os.path.isdir(db_path):
- dates = map(int, os.listdir(db_path))
+ dirs = [directory for directory in os.listdir(db_path) if
+ directory.isdigit()]
+ dates = map(int, dirs)
dates = sorted(dates, reverse=True)
for date in dates:
dump_filepath = ('/public/dumps/public/{0}/{1}/{2}-{3}-{4}'
--
To view, visit https://gerrit.wikimedia.org/r/488067
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: If0a39ab4e5f080ebe1963d61c9c9a6f6cdb11574
Gerrit-Change-Number: 488067
Gerrit-PatchSet: 2
Gerrit-Owner: Rafidaslam <rafidteam(a)gmail.com>
Gerrit-Reviewer: ArielGlenn <ariel(a)wikimedia.org>
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: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/488472 )
Change subject: [doc] Prepare next release
......................................................................
[doc] Prepare next release
Change-Id: I5968a905bc5b79d8eeac575c93956c69c34b99cf
---
M HISTORY.rst
M docs/conf.py
2 files changed, 7 insertions(+), 1 deletion(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index d16618f..c15d03a 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,12 @@
Current release
---------------
+* Bugfixes and improvements
+* Localisation updates
+
+3.0.20190204
+------------
+
* Support python version 3.7
* pagegenerators.py: add -querypage parameter to yield pages provided by any special page (T214234)
* Fix comparison of str, bytes and int literal with
diff --git a/docs/conf.py b/docs/conf.py
index ab3abdc..52a1f7a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -71,7 +71,7 @@
# The short X.Y version.
version = '3.0'
# The full version, including alpha/beta/rc tags.
-release = '3.0.20190106'
+release = '3.0.20190204'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
--
To view, visit https://gerrit.wikimedia.org/r/488472
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: I5968a905bc5b79d8eeac575c93956c69c34b99cf
Gerrit-Change-Number: 488472
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/487477 )
Change subject: [doc] Update HISTORY.rst file
......................................................................
[doc] Update HISTORY.rst file
Change-Id: I33ccefc1828a7e06ca2904ea25f5456dd7b35697
---
M HISTORY.rst
1 file changed, 5 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index 0033fb2..d16618f 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,11 @@
Current release
---------------
+* Support python version 3.7
+* pagegenerators.py: add -querypage parameter to yield pages provided by any special page (T214234)
+* Fix comparison of str, bytes and int literal with
+* site.py: add generic self.querypage() to query SpecialPages
+* echo.Notification has a new event_id property as integer
* Bugfixes and improvements
* Localisation updates
--
To view, visit https://gerrit.wikimedia.org/r/487477
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: I33ccefc1828a7e06ca2904ea25f5456dd7b35697
Gerrit-Change-Number: 487477
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)