Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #3701
Status: Failed
Duration: 1 hour, 12 minutes, and 16 seconds
Commit: b57e2e2 (master)
Author: dalba
Message: TestFactoryGenerator: Use the previously intrinsic values as generator limits
Also "User:Sn1per/sandbox" has been removed from [[category:Subpage testing]],
remove it from test_subpage_filter.
Bug: T150892
Change-Id: I97741ea5f7ed7ab63c4c96b611ed2b0fd0ada0dc
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/900c325ebef9...b57e2e24…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/176597707
--
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: page.py: Raise NoPage in WikibasePage.get if the entity does not exist
......................................................................
page.py: Raise NoPage in WikibasePage.get if the entity does not exist
The test "test_item_never_existed" in "wikibase_tests.py" was failing
because WikibasePage.get was raising APIError instead.
Change-Id: Ie36e0b6f9898ab7eb3c74ae81ba99ee7a5880ef6
---
M pywikibot/page.py
1 file changed, 8 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 61fb71a..06be97f 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -63,6 +63,7 @@
SiteDefinitionError,
UserRightsError,
)
+from pywikibot.data.api import APIError
from pywikibot.family import Family
from pywikibot.site import Namespace, need_version
from pywikibot.tools import (
@@ -3182,7 +3183,7 @@
try:
self.site.blockuser(self, expiry, reason, anononly, nocreate,
autoblock, noemail, reblock)
- except pywikibot.data.api.APIError as err:
+ except APIError as err:
if err.code == 'invalidrange':
raise ValueError("%s is not a valid IP range." % self.username)
else:
@@ -3492,7 +3493,12 @@
if not identification:
raise pywikibot.NoPage(self)
- data = self.repo.loadcontent(identification)
+ try:
+ data = self.repo.loadcontent(identification)
+ except APIError as err:
+ if err.code == 'no-such-entity':
+ raise pywikibot.NoPage(self)
+ raise
item_index = list(data.keys())[0]
if lazy_loading_id or item_index != '-1':
self.id = item_index
--
To view, visit https://gerrit.wikimedia.org/r/321842
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie36e0b6f9898ab7eb3c74ae81ba99ee7a5880ef6
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Remove of intrinsic limits in pagegenerators' args
......................................................................
Remove of intrinsic limits in pagegenerators' args
Bug: T148355
Change-Id: Ie05cc3289e8b5ef9b31e4a1cbca7cc4fb4183baf
---
M pywikibot/pagegenerators.py
M pywikibot/site.py
2 files changed, 23 insertions(+), 31 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index e60c98f..bec67ad 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -62,7 +62,7 @@
# most of these functions just wrap a Site or Page method that returns
# a generator
-parameterHelp = u"""\
+parameterHelp = """\
-catfilter Filter the page generator to only yield pages in the
specified category. See -cat for argument format.
@@ -174,20 +174,17 @@
-imagesused Work on all images that contained on a certain page.
Argument can also be given as "-imagesused:linkingpagetitle".
--newimages If given as -newimages:x, it will work on x newest images.
- Otherwise asks to input the number of wanted images.
+-newimages Work on the most recent new images. If given as -newimages:x,
+ will work on x newest images.
-newpages Work on the most recent new pages. If given as -newpages:x,
- will work on the x newest pages.
+ will work on x newest pages.
-recentchanges Work on the pages with the most recent changes. If
given as -recentchanges:x, will work on the x most recently
changed pages. If given as -recentchanges:offset,duration it
will work on pages changed from 'offset' minutes with
'duration' minutes of timespan.
-
- By default, if no values follow -recentchanges, then we pass
- -recentchanges:x where x = 60
Examples:
-recentchanges:20 gives the 20 most recently changed pages
@@ -274,12 +271,12 @@
-random Work on random pages returned by [[Special:Random]].
Can also be given as "-random:n" where n is the number
- of pages to be returned, otherwise the default is 10 pages.
+ of pages to be returned.
-randomredirect Work on random redirect pages returned by
[[Special:RandomRedirect]]. Can also be given as
"-randomredirect:n" where n is the number of pages to be
- returned, else 10 pages are returned.
+ returned.
-untagged Work on image pages that don't have any license template on a
site given in the format "<language>.<project>.org, e.g.
@@ -587,7 +584,6 @@
@rtype: LogeventsPageGenerator
"""
# TODO: Check if logtype is one of the allowed log types
- # TODO: -*log used 500 as default total, also use with -logevents?
# 'start or None', because start might be an empty string
total = None
@@ -679,7 +675,7 @@
# before -randomredirect
# otherwise default namespace is 0
namespaces = self.namespaces or 0
- gen = RandomRedirectPageGenerator(total=intNone(value) or 10,
+ gen = RandomRedirectPageGenerator(total=intNone(value),
site=self.site,
namespaces=namespaces)
elif arg == '-random':
@@ -688,7 +684,7 @@
# before -random
# otherwise default namespace is 0
namespaces = self.namespaces or 0
- gen = RandomPageGenerator(total=intNone(value) or 10,
+ gen = RandomPageGenerator(total=intNone(value),
site=self.site,
namespaces=namespaces)
elif arg == '-recentchanges':
@@ -718,7 +714,7 @@
_filter_unique=self._filter_unique)
elif arg == '-liverecentchanges':
- gen = LiveRCPageGenerator(self.site, total=intNone(value))
+ gen = LiveRCPageGenerator(site=self.site, total=intNone(value))
elif arg == '-file':
if not value:
value = pywikibot.input('Please enter the local file name:')
@@ -810,24 +806,19 @@
u'What page names are you looking for?')
gen = PrefixingPageGenerator(prefix=value, site=self.site)
elif arg == '-newimages':
- if not value:
- value = pywikibot.input(
- 'How many images do you want to load?')
- gen = NewimagesPageGenerator(total=int(value), site=self.site)
+ gen = NewimagesPageGenerator(total=intNone(value), site=self.site)
elif arg == '-newpages':
# partial workaround for bug T69249
# to use -namespace/ns with -newpages, -ns must be given
# before -newpages
# otherwise default namespace is 0
namespaces = self.namespaces or 0
- value = value if value else 60
gen = NewpagesPageGenerator(namespaces=namespaces,
- total=int(value),
+ total=intNone(value),
site=self.site)
elif arg == '-unconnectedpages':
- namespaces = self.namespaces or 0
- value = value if value else 60
- gen = UnconnectedPageGenerator(total=int(value), site=self.site)
+ gen = UnconnectedPageGenerator(total=intNone(value),
+ site=self.site)
elif arg == '-imagesused':
if not value:
value = pywikibot.input(
@@ -921,7 +912,7 @@
# exclude -log, -nolog
if log == 'log' and mode not in ['-', '-no'] and not tail:
mode = mode[1:]
- total = 500
+ total = None
if value:
try:
total = int(value)
@@ -1520,6 +1511,7 @@
if cls.__filter_match(page, prop, claim, qualifiers) and not negate:
yield page
+
# name the generator methods
ItemClaimFilterPageGenerator = ItemClaimFilter.filter
@@ -2025,7 +2017,7 @@
@deprecated_args(extension=None, number="total", repeat=None)
-def UnusedFilesGenerator(total=100, site=None):
+def UnusedFilesGenerator(total=None, site=None):
"""
Unused files generator.
@@ -2041,7 +2033,7 @@
@deprecated_args(number="total", repeat=None)
-def WithoutInterwikiPageGenerator(total=100, site=None):
+def WithoutInterwikiPageGenerator(total=None, site=None):
"""
Page lacking interwikis generator.
@@ -2120,7 +2112,7 @@
@deprecated_args(number="total", repeat=None)
-def LonelyPagesPageGenerator(total=100, site=None):
+def LonelyPagesPageGenerator(total=None, site=None):
"""
Lonely page generator.
@@ -2136,7 +2128,7 @@
@deprecated_args(number="total", repeat=None)
-def UnwatchedPagesPageGenerator(total=100, site=None):
+def UnwatchedPagesPageGenerator(total=None, site=None):
"""
Unwatched page generator.
@@ -2231,7 +2223,7 @@
@deprecated_args(number="total")
-def RandomPageGenerator(total=10, site=None, namespaces=None):
+def RandomPageGenerator(total=None, site=None, namespaces=None):
"""
Random page generator.
@@ -2247,7 +2239,7 @@
@deprecated_args(number="total")
-def RandomRedirectPageGenerator(total=10, site=None, namespaces=None):
+def RandomRedirectPageGenerator(total=None, site=None, namespaces=None):
"""
Random redirect generator.
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 780b48b..ec98c49 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -4805,14 +4805,14 @@
return self.randompages(total=1, redirects=True)
@deprecated_args(step=None)
- def randompages(self, total=10, namespaces=None,
+ def randompages(self, total=None, namespaces=None,
redirects=False, content=False):
"""Iterate a number of random pages.
Pages are listed in a fixed sequence, only the starting point is
random.
- @param total: the maximum number of pages to iterate (default: 1)
+ @param total: the maximum number of pages to iterate
@param namespaces: only iterate pages in these namespaces.
@type namespaces: iterable of basestring or Namespace key,
or a single instance of those types. May be a '|' separated
--
To view, visit https://gerrit.wikimedia.org/r/321484
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie05cc3289e8b5ef9b31e4a1cbca7cc4fb4183baf
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Multichill <maarten(a)mdammers.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>