Build Update for xZise/pywikibot-core
-------------------------------------
Build: #19
Status: Errored
Duration: 44 minutes and 3 seconds
Commit: ea11efa (MDW-module)
Author: Fabian Neundorf
Message: [IMPROV] ModuleDeprecationWrapper is module
It is a replacement for modules so it should be subclass of module. Also
sorted the imports alphabetically.
Change-Id: If8b2c79f36525bc1c4437bed27c455d8e9f170aa
View the changeset: https://github.com/xZise/pywikibot-core/compare/b152ee84cf4c^...ea11efa60de5
View the full build log and details: https://travis-ci.org/xZise/pywikibot-core/builds/46242274
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #1894
Status: Errored
Duration: 47 minutes and 23 seconds
Commit: 693d9bb (master)
Author: Fabian Neundorf
Message: [FIX] Pagegen test: Allow same chars anywhere
The test_regexfilter_default test requires that a page begins with the
same character at least twice. This is obviously not possible on
wikidata because all main namespace pages begin with Q and a digit which
are never the same. Thus the test never ends because it can't find 10
pages. This removes the requirement that the first two chracters need to
be the same, although this could still cause freezes if a wiki is very
small and doesn't contain 10 pages which have at least the same
character twice.
Those tests aren't executed by travis with wikidata configured so it
doesn't happen there currently.
Change-Id: I312334bc202894c7eb224c5f46ec32b725c2c961
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/6a49649e141e...693d9bbb…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/46238463
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Pagegen test: Allow same chars anywhere
......................................................................
[FIX] Pagegen test: Allow same chars anywhere
The test_regexfilter_default test requires that a page begins with the
same character at least twice. This is obviously not possible on
wikidata because all main namespace pages begin with Q and a digit which
are never the same. Thus the test never ends because it can't find 10
pages. This removes the requirement that the first two chracters need to
be the same, although this could still cause freezes if a wiki is very
small and doesn't contain 10 pages which have at least the same
character twice.
Those tests aren't executed by travis with wikidata configured so it
doesn't happen there currently.
Change-Id: I312334bc202894c7eb224c5f46ec32b725c2c961
---
M tests/pagegenerators_tests.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index b11432f..7ffe7a1 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -471,15 +471,15 @@
def test_regexfilter_default(self):
gf = pagegenerators.GeneratorFactory()
- # Matches titles with the same two or more starting letters
- self.assertTrue(gf.handleArg('-titleregex:^(.)\\1+'))
+ # Matches titles with the same two or more continous characters
+ self.assertTrue(gf.handleArg('-titleregex:(.)\\1+'))
gf.handleArg('-limit:10')
gen = gf.getCombinedGenerator()
pages = list(gen)
self.assertLessEqual(len(pages), 10)
for page in pages:
self.assertIsInstance(page, pywikibot.Page)
- self.assertRegex(page.title().lower(), '^(.)\\1+')
+ self.assertRegex(page.title().lower(), '(.)\\1+')
def test_regexfilter_ns(self):
raise unittest.SkipTest('This test takes over 10 minutes due to T85389')
--
To view, visit https://gerrit.wikimedia.org/r/183312
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I312334bc202894c7eb224c5f46ec32b725c2c961
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: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [FEAT] WikidataBot: Allow direct usage on Wikidata
......................................................................
[FEAT] WikidataBot: Allow direct usage on Wikidata
The current WikidataBot requires that the generator works on pages and
that the ItemPages are created from them. But if the generator is
iterating over ItemPages from Wikidata it should use those directly.
There are three possible modes: It either always uses the
ItemPage.fromPage method or ItemPage constructor or it uses
ItemPage.fromPage only when the page is not in the item namespace.
Change-Id: I8b3f27c9e559dfbeb4a557a0b209b2e978ada5aa
---
M pywikibot/bot.py
M scripts/claimit.py
2 files changed, 32 insertions(+), 6 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
M4tx: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 21eb4a4..d56b526 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1133,7 +1133,17 @@
"""
def __init__(self, **kwargs):
- """Constructor."""
+ """
+ Constructor of the WikidataBot.
+
+ @kwarg use_from_page: If True (default) it will apply ItemPage.fromPage
+ for every item. If False it assumes that the pages are actually
+ already ItemPage (page in treat will be None). If None it'll use
+ ItemPage.fromPage when the page is not in the site's item
+ namespace.
+ @kwtype use_from_page: bool, None
+ """
+ self.use_from_page = kwargs.pop('use_from_page', True)
super(WikidataBot, self).__init__(**kwargs)
self.site = pywikibot.Site()
self.repo = self.site.data_repository()
@@ -1180,10 +1190,26 @@
for page in self.generator:
if not page.exists():
pywikibot.output('%s doesn\'t exist.' % page)
- try:
- item = pywikibot.ItemPage.fromPage(page)
- except pywikibot.NoPage:
- item = None
+ # FIXME: Hack because 'is_data_repository' doesn't work if
+ # site is the APISite. See T85483
+ data_site = page.site.data_repository()
+ if (data_site.family == page.site.family and
+ data_site.code == page.site.code):
+ is_item = page.namespace() == data_site.item_namespace.id
+ else:
+ is_item = False
+ if self.use_from_page is not True and is_item:
+ item = pywikibot.ItemPage(data_site, page.title())
+ item.get()
+ elif self.use_from_page is False:
+ pywikibot.error('{0} is not in the item namespace but '
+ 'must be an item.'.format(page))
+ continue
+ else:
+ try:
+ item = pywikibot.ItemPage.fromPage(page)
+ except pywikibot.NoPage:
+ item = None
if not item:
if not treat_missing_item:
pywikibot.output(
diff --git a/scripts/claimit.py b/scripts/claimit.py
index 96471c2..b1a968d 100755
--- a/scripts/claimit.py
+++ b/scripts/claimit.py
@@ -81,7 +81,7 @@
* exists_arg - String specifying how to handle duplicate claims
"""
- super(ClaimRobot, self).__init__()
+ super(ClaimRobot, self).__init__(use_from_page=None)
self.generator = generator
self.claims = claims
self.exists_arg = exists_arg
--
To view, visit https://gerrit.wikimedia.org/r/182110
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8b3f27c9e559dfbeb4a557a0b209b2e978ada5aa
Gerrit-PatchSet: 5
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: M4tx <m4tx(a)m4tx.pl>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #1890
Status: Errored
Duration: 53 minutes and 27 seconds
Commit: cd7fbb3 (master)
Author: xqt
Message: Updated pywikibot/core
Project: pywikibot/i18n 18c70c9e3a755561ddec605e7f9d06c578460a2f
Sort package keys
Because we aren't ready reading i18n directly from json files,
we have to use the current files. Due to updating these files
from json files it is necessary to sort it's contents first
so that we can confirm further changes in an easy way.
Change-Id: I2be6b39cec882c60d45e6c436c538613fa3bafa7
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/be9f60224994...cd7fbb31…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/46084406
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications